if your computer restarts before reaching to OS pls do the following.
1) Disconnect all the drives (HDD, CD, FDD etc.
2) only keep monitor cable and keyboard cable connected.
3) start the PC and go to BIOS and check whether it restarts again.
4) if restarts pls make sure the processor is not over heating.
if it reaches to the OS and then restarts then try to check the memory first and then try OS repair.