Infosys Interview Question

I was asked to write code for prime number