sir as in while(p*p<=m)
this is said i dont think this is right as suppose m=10 and p is intially 2
after first iteration value of p=3 and m=5
and if we check here while condition it becomes false
as 9<=5 is false so we get answer as 2 thats wrong