这是一个比较简单的问题,我却在前几天的一次考试中没有写出来。
#include "math.h"
#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int m ,i ,k, h = 0, leap = 1;
for(m = 101;m <= 200; m++)
{
k = sqrt(m + 1);
for(i = 2;i <= k; i++)
if(m%i == 0)
{
leap = 0;
break;
}
if(leap)
{
printf("%-4d\n",m);
h++;
if(h%10 == 0)
printf("\n");
}
leap = 1;
}
// printf("\n the total is %d\n", h//);
// printf("%d\n", h);
}
386

被折叠的 条评论
为什么被折叠?



