LTIMindtree Interview Question

Write the optimal code for prime number in C++