【SWU} 如何判断一个数是质数?
1 #include <stdio.h>
2
3 int main ()
4 {
5 int i,j;
6 scanf ("%d", &j);
7 if(j<2)
8 {
9 printf("no\n");
10 }
11 else{
12 if(j==2)
13 {
14 printf("yes\n");
15 }
16 else{
17 i=2;
18 while (i<j)
19
20 if(j%i==0)
21 {printf("no\n");}
22
23 else{printf("yes\n");}
24 i ++;
25 }
26 }
27
28 return 0;
29 }
问题:为什么判断一个大于2的数时,输出的一直是yes 或no,该怎样解决这个循环体?