解题思路;
1.利用while(1)+break 循环,列举出所有7的倍数。
2.判断这个数是不是符合要求。
3。如果符合,输出这个数,不然按继续循环。
代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a=0;
while(1) //重复循环直到找到合适的数。
{
a=a+7;
if(a%2==1&&a%3==1&&a%4==1&&a%5==1&&a%60==1&&a%7==0)//对比。
{
cout<<a;//如果符合,输出这个数。
break; //然后跳出循环。
}
}
return 0;
}
ps.实际上,如果你脑子好,可以直接算出来,然后直接输出。