#6035: line 22 WA,why?


mihozip (阿飄飄)


請各位大德幫小弟看看為啥到line22 會WA?

#include <iostream>

#include <cmath>

int main()

{

int a,i,r;

while(std::cin >>a){

 

for (i=2;i<=sqrt(a);i++){

r=a%i;  

if(a%i==0){std::cout <<"非質數" <<std::endl;break;}

}

if(r!=0){std::cout <<"質數" <<std::endl;}

}

return 0;