帮我修改程序代码

[复制链接]
查看11 | 回复2 | 2010-4-22 16:49:09 | 显示全部楼层 |阅读模式
#includeint main(){int weishu(int x);int n,s;printf("请输入数字");scanf("%d",&n);s = weishu(n);printf("%d",s);getchar();getchar();getchar();getchar();getchar();return 0;}int weishu(int x){ int s=0; while(x) {x/=10;s++;}return s;}//祝你成功
回复

使用道具 举报

千问 | 2010-4-22 16:49:09 | 显示全部楼层
//一楼的该这样改一下吧,,int weishu(int n){int sum=0; while(n/10!=0)
{n=n/10;sum++;}return sum+1;
回复

使用道具 举报

千问 | 2010-4-22 16:49:09 | 显示全部楼层
我觉得你weishu函数可以这样写int weishu(int n){int sum; while(n/10!=0)
n=n/10,sum++;return sum+1;}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行