#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main(void)
{
int n,num,sum=0,t;
puts("请输入位数和数字");
scanf("%d%d", &n,&num);
t = num;
for (int i = 0; i <n; i++) {
sum += num;
printf("sum%d\n", sum);
num *= 10;//注意10+t会变成整体
num += t;
printf("num%d\n", num);
}
printf("S%d为%d\n", n, sum);
登录后提交答案