main(){
int a,n,count=1;
long int sn=0,tn=0;
cout<<"input a and n:";
cin>>a>>n;
while(count<=n){
tn=tn+a;
sn=sn+tn;
a=a*10;
++count;}
cout<<"a+aa+aaa+a........"<<sn;
时间: 2024-11-03 22:29:17
main(){
int a,n,count=1;
long int sn=0,tn=0;
cout<<"input a and n:";
cin>>a>>n;
while(count<=n){
tn=tn+a;
sn=sn+tn;
a=a*10;
++count;}
cout<<"a+aa+aaa+a........"<<sn;