Cognizant interview question

prime number code and oops