I have installed minGW, and I have a file \"test.c\".
I typed gcc test.c -o demo at the command prompt, while in the directory where I saved the \"test.c\"
gcc test.c -o demo
You are missing on Path Variable settings. Refer the 'Environment Settings' section on this page :
Path Variable
http://www.mingw.org/wiki/Getting_Started