Infosys interview question

Code to check for a prime number