how to write a C program to convert source code to flow graph .
Work out a simple example of it, by hand. What steps did you take to do it? Now do a moderately more difficult example? Again, what steps did you need to use to make that graph?
Merge those necessary steps, into pseudo code, and combine it with more pseudo code for your program. That's the backbone of your program (hopefully). If not, at least it's a good starting point to learn from.
You can't sit down and code up a program to do something that you don't know how to solve. You're putting the cart before the horse, and that's generally a big waste of time.