#include <iostream>
using namespace std;
int hws(int n) {
int i = n;
int m = 0;
while (i > 0) {
m = i % 10 + m * 10;
i=i / 10;
}
return m;
}
int main() {
int x = 11;
do {
if (x == hws(x) && pow(x, 2) == hws(x * x) && pow(x, 3) == hws(x * x * x))
cout << "x=" << x << "是回文数" << "满足题目要求" << endl;
x++;
} while (x <= 999);
return 0;
}
寻找并输入11~999之间的数m,它满足m,m^2和m^3均为回文数。
最新推荐文章于 2022-11-29 23:15:08 发布