C语言,已知四位数3025具有一个特殊性质:它的前两位数字30与后两位数字25之和是55,而55的平方正好等于3025。编程找出所有具有这种性质的四位数。输出格式:每一个四位数自占一行,行首输出。(按照从小到大的顺序输出)
时间: 2024-05-02 11:20:44 浏览: 154
以下是代码实现:
```c
#include <stdio.h>
int main() {
for (int i = 10; i < 100; i++) {
for (int j = 10; j < 100; j++) {
if (i * 100 + j == (i + j) * (i + j)) {
printf("%d%d\n", i, j);
}
}
}
return 0;
}
```
输出结果:
```
2025
3025
```
阅读全文
相关推荐
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![cpp](https://img-home.csdnimg.cn/images/20250102104920.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)