从0数到数字100,如果该数字是7的倍数,或者数字的个位或者十位含有7,我们打印敲桌子,其余数字直接打印输出。
#include<iostream>
using namespace std;
int main()
{
int i = 1;
for (i = 1;i <= 100;i++)
{
if (i % 7 == 0 || i % 10 == 7 || i / 10 == 7)
cout << "敲桌子" << endl;
else
cout << i << endl;
}
system("pause");
return 0;
}