I want to draw a pattern like this:
the code below is what I tried and the output for this code is like this:
#include <stdio.h>
int main() {
int a, b, c, s;
for (a = 5; a >= 1; a--) {
for (s = a; s <= 4; s++) {
printf(" ");
}
for (b = a; b <= 9; b++) {
printf("%d", b);
}
for (c = 8; c >= a; c--) {
printf("%d", c);
}
printf("\n");
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire