编写一个程序,计算s=a aa
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/10 13:39:15
inta,n;doublesum=0;scanf("%d%d",&a,&n);for(sum=a,i=2;i
#include#includemain(){inta,n,i,sum=0,sum1,sum2,sum3;//sum为最后结果printf("inputthenumbera:");scanf("%d"
s=0k=1whilei
INPUT"a=";aINPUT"n=";ntn=0sn=0i=1WHILEi
要写的话太麻烦了.我就告诉你基本思路吧数字a没关系但是个数n的话,s=0个位有n个as=s+na十位有n-1个as=s+10(n-1)a百位有n-2个as=s+100(n-2)a千位有n-3个a一直做
#includeusingnamespacestd;//Sn=a+aa+aaa+...+(n个a)//uA表示a//uN表示n//返回值为SnunsignedintSigmaN(unsignedint
#includemain(){intn;longa,sum=0;printf("pleaseinputaandn,andpressEntertocontinue\n");scanf("%ld%d",&
inputa,ni=0m=0s=0DOb=10^im=a*b+ms=s+mi=i+1LOOPUNTILi>=nprintsend童鞋你不会是八中的吧.同一天同一道题.求班级,我就只给你一种解法吧再问:
VB程序PrivateSubCommand1_Click()Dima,iAsIntegeri=1Whilei<50s=s+(i+1)/ii=i+1WendPrint"s=";sEndSu
voidmain(){inta,n,i;inttemp,s;scanf("%d%d",&a,&n);if(a9||n
#includeintfn(inta,intn);intmain(){inta,n,m,sum;printf("请分别输入a和n,用空格分开");scanf("%d%d",&a,&n);m=n+1,s
用你那个问题的格式:reada,nt←as←0forifrom1tons←s+tt←t*10+aendforprintsend
LZ不给分加一下最佳总可以吧?注意是BASIC不是BUSICinputa,ni=1s=0dos=s+aa=a+a*10^ii=i+1whilei
#include"stdio.h"main(){longa,i,p,s,N;printf("请输入a值:\n");scanf("%ld",&a);printf("请输入a小于等于:\n");scanf
希望能帮到你.#include"stdio.h"intmain(){inti,j,n,s,temp;printf("请输入n的值:");scanf("%d",&n);for(i=1;i
publicclassTest{publicstaticvoidmain(String[]args){ints=0;intn=1;for(inti=0;i
;MOVAX,AANDAX,B;AX=aANDbMOVBX,AXORBX,B;BX=aXORbADDAX,BXADDAX,BX;AX=2*(aXORb)+aANDbADDAX,A;AX=a+2*(aX
CLEARSETTALKOffs1=0forn=1to10s1=s1+jc(n)next"1!+2!+3!+.+10!=",s1FUNCTIONjcPARAMETERSis=1FORj=1TOis=s
这是c++程序的源代码,我已经运行过了,准确无误#includeusingnamespacestd;intmain(){inta,n,u,sum;coutn;u=sum=a;cout
是不是这个题目啊:编程计算a+aa+aaa+…+aa…a〔n个a〕的值,n个a的值由键盘输入#include#includevoidmain(){inta,n,sum=0,temp=0;printf(