您的位置:首页 > 其它

编写程序得出1到100的所有整数出现对少次九

2014-12-28 01:38 204 查看
#include <stdio.h>

void fun( int n )
{
int num = 1;
int count = 0;
while( num < 100 )
{
n = num;
while( n!=0 )
{
if( n % 10 == 9 )
count++;
n = n / 10;
}
num++;
}
printf("%d\n",count);
}

int main()
{
fun( 100 );
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐