通过编程实现,统计1~n有多少个9 提示:n通过参数传入
来源:互联网 发布:超少年密码之人工智能 编辑:程序博客网 时间:2024/06/05 07:13
#include <stdio.h>int fun(int n){ int i; int tmp; int k; int count = 0; for(i=1;i<=n;i++) { tmp = i; while(tmp != 0) { if(tmp == 9 || k == 9) { count++; } k = tmp % 10; tmp = tmp / 10; } } return (count-1);}int main(){ int num; int count = 0; printf("Please input n:"); scanf("%d",&num); count = fun(num); printf("the number of 9 between 1 and %d is:%d\n",num,count); return 0;}
0 0
- 通过编程实现,统计1~n有多少个9 提示:n通过参数传入
- 1.题目:通过编程实现,统计1~n有多少个9 提示:n通过参数传入
- 强化练习1:通过编程实现,分别统计0~n有多少个0~9 提示:n通过参数传入
- .通过编程实现,统计1~n有多少个9 (n通过参数传入)
- 初入C语言!整数算法练习1:通过编程实现,统计1~n有多少个9 ? 提示:n通过参数传入!
- 统计1~n有多少个9 ,n通过参数传入
- 通过编程实现,统计1~n有多少个9
- 通过编程实现,统计1~n有多少个9
- 通过编程实现,统计1~n有多少个9
- 通过编程实现,统计1~n有多少个9
- 题目:通过编程实现,统计 1~n 有多少个 9
- 统计1~n有多少个9
- 统计1~n有多少个9
- 统计1~n有多少个9
- 统计1~n有多少个9
- 题目3:统计0~n中有多少个9
- 整数算法训练01—统计1~n有多少个9
- 编程求 n 这个数有多少个0~9?
- 使用回调实现对一组任意类型的对象做快速排序
- 实现时分秒的倒计时效果
- for和foreach循环的效率对比
- Android Studio导入jar包
- 自定义View的分类和流程
- 通过编程实现,统计1~n有多少个9 提示:n通过参数传入
- springmvc整合freemarker,使用ftl文件
- Redis 字符串(String)
- 理解HTTP幂等性
- HDOJ1005 Number Sequence
- 按之字形顺序打印二叉树
- 解决UnicodeEncodeError: 'ascii' codec can't encode characters in position问题
- svn之Previous operation has not finished; run 'cleanup' if it was interrupted解决办法
- eclipse在线安装CheckStyle