习题10-1 判断满足条件的三位数 (15 分)
作者:互联网
#include <stdio.h> #include <math.h> int search(int n); int main() { int number; scanf("%d", &number); printf("count=%d\n", search(number)); system("pause"); return 0; } /* 你的代码将被嵌在这里 */ int search(int n) { int count = 0; int a1, a2, a3; for (int i = 11; i*i < n; i++) { a1 = i * i % 10; a2 = i * i / 10 % 10; a3 = i * i / 100; if (a1 == a2 || a1 == a3 || a2 == a3) count++; } return count; }
标签:count,10,15,int,a1,a3,a2,习题 来源: https://www.cnblogs.com/Robert-De-Niro/p/15911937.html