输出1~100数字,数字为7的倍数,个位有7和十位有7输出敲桌子
代码如下:
#include <iostream>
using namespace std;
int main()
{
for (int i = 1;i<=100;i++)
{
if (i%7==0||i%10==7||i/10==7)//i%7=0为7的倍数;i%10=7为个位7;i/10=7为十位为7
{
cout << "敲桌子" << endl;
}
else
{
cout << i << endl;
}
}
system("pause");
return 0;
}