> 其他 >
求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是相加的个数,当N=5时,代 表最大数是5*/
scanf("%d%d",&a,&N);
for(i=1;i
人气:428 ℃ 时间:2020-03-27 06:31:56
解答
第二次循环时,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是相加的个数,当N=5时,代 表最大数是5*/ scanf("%d%d",&a,&N);b=a; for(i=1;i...
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版