iMac sounds like it's starting up then shutting down immediately
Open it up, check for dust, reinstall the Mac OS X (fresh installation), Check whether the fan is functioning properly. If all these doesn't solve the issue, then probably you will need to get it examined by an Apple service guy.