C++演示逢七必过(1~100)

  • Post author:
  • Post category:其他


#include<iostream>

using namespace std;

int main()

{


int a = 0;

int b = 0;

for (int n = 1; n <= 100; n++)

{


a = n % 10;

b = n / 10;

if (n % 7 == 0 || a == 7 || b == 7)

cout << “过” << endl;

else

cout << n << endl;

}

return 0;

}



版权声明:本文为qq_60483277原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。