Text Practice Mode
LATIHAN NGETIK BUAT CODING C
created Jan 7th 2022, 08:53 by SlowHandisti
2
72 words
22 completed
0
Rating visible after 3 or more votes
saving score / loading statistics ...
00:00
#include <stdio.h>
int main() {
int n, jumlah = 0, RW[10][2];
scanf("%d", &n);
for(int i = 0; i < n; i++) {
scanf("%d %d", &RW[i][0], &RW[i][1]);
}
for(int i = 0; i < n; i++) {
jumlah += RW[i][1];
}
printf("%d\n", jumlah);
for(int i = 0; i < n; i++) {
printf("%d ", RW[i][0]);
for(int j = 0; j < RW[i][1]; j++) {
printf("*");
}
printf(" %d\n", RW[i][1]);
}
return 0;
}
int main() {
int n, jumlah = 0, RW[10][2];
scanf("%d", &n);
for(int i = 0; i < n; i++) {
scanf("%d %d", &RW[i][0], &RW[i][1]);
}
for(int i = 0; i < n; i++) {
jumlah += RW[i][1];
}
printf("%d\n", jumlah);
for(int i = 0; i < n; i++) {
printf("%d ", RW[i][0]);
for(int j = 0; j < RW[i][1]; j++) {
printf("*");
}
printf(" %d\n", RW[i][1]);
}
return 0;
}
