035.程序流程结构-循环结构案例-敲桌子

#include <iostream>
using namespace std;
int main()
{
    //敲桌子
    //输出1-100;
    for (int i = 1; i <= 100; i++)
    {
        //从100个数字找到特殊数字,打印敲桌子
        //如果是7的倍数,个位,十位有7,打印敲桌子
        if (i%7==0||i%10==7||i/10==7)
        {
            cout << "敲桌子" << endl;
        }
        else
        {
            cout << i << endl;
        }
    }
    system("pause");
    return 0;
}

 

posted @ 2021-09-04 09:10  梦之心  阅读(40)  评论(0编辑  收藏  举报