Sir doubt in algorithm

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

ha to @tejasddongare
m = 10 h to
factor ekh 2 ajayega
then as u correctly stated 9 <=5 false h
to while loop se bhar ajayega

to m!= 1
then ekh factor 5 ajayega

so 2 factors are 2,5