输出100~200的素数
老铁给看下有哪些问题,输出不行#include<stdio.h>
int main()
{
int i,n,m;
n=100;
while(n<=200)
{
n=n+1;
m=n-1;
while(i>=n)
{
i=2;
i=i+1;
if(n%i==0)break;
if(i>m)
{
printf("%d",n);
}
}
}
return 0;
}
#include<stdio.h> int main() { int i = 0, n, m; n = 100; while (n <= 200) { n = n + 1; m = n - 1; i = 2; while (i <= m) { //i = 2; i = i + 1; if (n%i == 0)break; if (i==m) { printf("%d ", n); } } } return 0; }
#include<stdio.h> int main() { int n, m; n = 100; while (n <= 200) { n += 1; m = n - 1; while (m >= 2) { if (n%m == 0) break; if (m == 2) printf("%d\n", n); m -= 1; } } getchar(); getchar(); return 0;