码迷,mamicode.com
首页 >  
搜索关键字:计算整数出现次数    ( 1个结果
C语言:编写程序数一下 1到 100 的所有整数中出现多少次数字 9
#include<stdio.h> intmain() { intnum,hundred,ten,unit,count=0; for(num=1;num<=100;num++) {hundred=num/100; ten=(num-hundred*100)/10; unit=num-hundred*100-ten*10; if(hundred==9) { count++; } if(ten==9) { count++; } if(unit==9) { count++; } } printf(..
分类:编程语言   时间:2015-10-07 23:07:44    阅读次数:191
1条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!