One night I turned my pc on , after some time when I came back I saw the power lights blinking and fans turning on and of . I am very very new to computers, please help me

The first thing I would do is leave it powered off for a couple of hours (in case it is an overheating problem). Then I would try booting it into diagnostic mode and running the diagnostics. If this is available it is likely available by pressing F12 (can vary from manufacturer to manufacturer) during boot. Keep an eye on the computer while the diagnostics are running. Pay particular attention to whether or not the fan comes on. If it is noisy then that will tell you something. If it doesn't come on at all then I would suspect overheating and you may need to replace the fan. Another possilbe cause of overheating is a deterioration of the thermal paste between the CPU and the heat sink. It might be useful to know how long it takes the system to fail.

Post your results here.