在2楼的基础改动一点点
# include <stdio.h>
int main ()
{ int n,a,b,i=1; long s=0; scanf ("%d,%d",&a,&n);/*输入数据时会更好,加以区分*\ b=a; while (i<=n) { s=s+a; a=a*10+b; i++; }
#include<stdio.h>
void main()
{ int a,n,i=1,a1; long int s=0; printf("enter your number to test:"); scanf("%d%d",&a,&n); a1=a; while(i<=n) { printf("%d+",a); s=s+a; a=a*10+a1; i++; } printf("\b=%d\n",s); exit(0);
}
# include <stdio.h>
int main () { int n,a,s=0,i=1,b; scanf ("%d%d",&a,&n); b=a; while (i<=n) { s=s+a; a=a*10+b; i++; } printf ("s=%d\n",s); return 0; }