I'm working on the first 2 parts (the ascending numbers and the spaces) Original
this is how it's supposed to look like:
1 2 3 4 5 4 3 2 1
2 3 4 5 4 3 2
3 4 5 4 3
4 5 4
5
My code is:
#include <stdio.h>
main()
{
int N, i, j, M;
do {
printf("Entrez la valeur de N : ");
scanf("%d", &N);
} while (N <= 0 || N % 2 == 0);
M = N;
for (N = N; N >= 0; N--) {
for (i = M; M - N > 0; i--)
printf(" ");
for (j = 1; j <= N; j++) {
printf(" %d ", j);
}
printf("
");
}
}
question from:https://stackoverflow.com/questions/66051243/drawing-a-numbered-triangle-in-c-using-loops