标签:i++ ret for scanf printf 传参 include 个数 ase
//计算出1-n(n通过传参实现)中有多少个9。 #include<stdio.h> int main() { int n; printf("Please input a number:\n"); scanf("%d",&n); fun(n); return 0; } void fun(int n) int i,a,b; int count = 0; for(i = 1;i <= n;i++) { a = i; while(a != 0) { b = a % 10; a = a / 10; if(b == 9) { count++; } } } printf("9的个数是:%d\n",count); }
标签:i++ ret for scanf printf 传参 include 个数 ase
原文地址:http://www.cnblogs.com/Janskid/p/7147602.html