已经拿去散了
梅尚程荀
马谭杨奚
#include <stdio.h> #include <math.h> int judge(); int main() { int n, m = 0, i; printf("please input n:"); scanf("%d", &n); for (i = 1; i <= n; i++) if (judge(i)) { m++; printf("%-5d", i); if (m % 10 == 0) printf("\n"); } return 0; } int judge(int n) { int i = 0, j, k = 0; int m, s, sum = 0; m = n * n; s = n; while (n != 0) { n = n / 10; i++; } for (j = 0; j < i; j++) { k = m % 10; k = k * pow(10, j); m = m / 10; sum += k; } if (sum == s) return 1; else return 0; }