XYZ interview question

The Code on Prime Number