Capgemini interview question

How to write the code for prime numbers