#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int N, sum, i;
/* while(scanf("%d", &N) != EOF)*/
while(scanf("%d", &N) != 0) //输入N值,若N不是文件结束符则执行循环体
{
sum = 0;
printf("在1-N中有:");
for(i = 7 ;i<=N;i++)
if (i % 2 == 1 && i % 3 == 2 && i % 5 == 4 && i % 6 == 5 && i % 7 == 0)
{
sum++;
printf("%4d", i);
}
printf("\n共有%d个\n", sum);
}
return 0;
}
标签:爱因斯坦,int,scanf,while,数学题,sum
From: https://www.cnblogs.com/258-333/p/17383144.html