Thanks osgx,
As I am newbie I couldn't make out what these pthreads
meant.
But after all I found solution to my problem.
I installed gcc 4.8.2 64 bit
on my machine from http://www.equation.com/servlet/equation.cmd?fa=fortran.
It changed the environment variable (in path) itself. After finishing installation,
I restarted my computer
and when I typed:
gcc -fopenmp hello.c
for the above code in command line, the code worked.