C语言程序求具有abcd=(ab+cd)2性质的四位数。 **输入格式要求:提示信息:"There are following numbers:\n" **输出格式要求:"%d "(注意%d后面又两个空格) 程序运行示例如下: There are following numbers: 2025 3025 9801
时间: 2023-06-27 14:01:32 浏览: 98
求具有abcd=(ab+cd)2性质的四位数.rar_3025性质_husbando7z
5星 · 资源好评率100%
```c
#include <stdio.h>
int main() {
printf("There are following numbers:\n");
for (int i = 1000; i < 10000; ++i) {
int ab = i / 100;
int cd = i % 100;
if ((ab + cd) * (ab + cd) == i) {
printf("%d ", i);
}
}
return 0;
}
```
输出结果为:
```
There are following numbers:
2025 3025 9801
```
阅读全文