代码
#include<iostream>
using namespace std;
int main()
{
int x;
for (x = 1; x <= 999; x++)
{
if ((x / 100) * ((x / 10) % 10) * (x % 10) == 32 && (x / 100) + ((x / 10) % 10) + (x % 10) == 10)
{
cout << x << endl;
}
}
system("pause");
return 0;
}
输出结果
244
424
442
利用for循环嵌套if语句的方法判断三位数中的哪些数字符合输出条件