1.题目:通过编程实现,统计1~n有多少个9
#include <stdio.h> void Count(int n) { int i; int temp; int count = 0; int b; for(i = 1; i <= n; i++) { temp = i; while(temp != 0) { b = temp % 10; temp = temp / 10; if(b == 9) { count++; } } } printf("The result is:%d\n", count); } int main() { int n; printf("Enter a number!\n"); scanf("%d", &n); Count(n); return 0; } #include <stdio.h> void Co