1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00
202401-programming-assignments/【实践课外】5.循环结构2/7-2 循环-aaaa.c

22 lines
284 B
C
Raw Normal View History

2024-10-30 03:44:18 +00:00
#include <stdio.h>
int main() {
int a, n, sum = 0;
scanf("%d%d", &a, &n);
for (int i = 1; i <= n; i++) {
int x = 0;
for (int j = 0; j < i; j++) {
x = x * 10 + a;
}
sum += x;
}
printf("%d\n", sum);
return 0;
}