当前位置: > 求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字.例如2+22+222+2222+22222(此时...
题目
求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字.例如2+22+222+2222+22222(此时
这是我写的代码,但是当s=2+22+222,时得出266.
#include"stdio.h"
main()
{
long s=0;
int a,N,i;
printf("Enter the a and N: ");/*N是相加的个数,当N=5时,代 表最大数是5*/
scanf("%d%d",&a,&N);
for(i=1;i

提问时间:2020-08-07

答案
第二次循环时,a=22*10+22=242.稍改一下#include"stdio.h" main() { long s=0; int a,b,N,i; printf("Enter the a and N: ");/*N是相加的个数,当N=5时,代 表最大数是5*/ scanf("%d%d",&a,&N);b=a; for(i=1;i...
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.