#include <stdio.h> int main() { int count = 0;//记录个数 int i = 0; for (i = 1; i <= 2019; i++)//遍历 { int m = i; while (m > 0) { if (m % 10 == 9) { count++; break; } else { m /= 10; } } } printf("%d\n", count); return 0; }
#include <stdio.h> int main() { int count = 0;//记录个数 int i = 0; for (i = 1; i <= 2019; i++)//遍历 { int m = i; while (m > 0) { if (m % 10 == 9) { count++; break; } else { m /= 10; } } } printf("%d\n", count); return 0; }