Capgemini Interview Question

How to write the code for prime numbers