Infosys Interview Question

Code for prime number