2 回答

慕移動6052691
TA貢獻(xiàn)22條經(jīng)驗(yàn) 獲得超7個贊
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
bool isMod2(int n)
{
//被3/5/7 除余數(shù)均為2
if( (n%3 == 2) && (n%5 == 2) && (n%7 ==2) )
return true;
else
return false;
}
int main()
{
int count = 1;
int n = 500;
while(count <= 50)
{
if( isMod2(n) )
{
printf("被3、5、7除均為2,第%d個數(shù)它是:%d\n",count,n);
count++;
}
n++;
}
system("pause");
? ??
}
- 2 回答
- 0 關(guān)注
- 1477 瀏覽
添加回答
舉報
0/150
提交
取消