Add affichage tableau

This commit is contained in:
flyingscorpio@pinebookpro 2021-11-02 13:24:17 +01:00
parent 28887a04d7
commit 0dbdf7cd79
2 changed files with 24 additions and 0 deletions

1
.gitignore vendored
View file

@ -22,3 +22,4 @@ tables-multiplication
triangle-des-etoiles
factorielle
calculatrice
affichage-tableaux

View file

@ -0,0 +1,23 @@
/* Affichage tableaux */
#include <stdio.h>
#include <stdlib.h>
#define LONGUEUR_TABLEAU 5
int main() {
int tableau[LONGUEUR_TABLEAU] = {42, 35, 26, 40, 2};
for (int i = 0; i < LONGUEUR_TABLEAU; i++) {
printf("%d ", tableau[i]);
}
printf("\n");
for (int i = LONGUEUR_TABLEAU - 1; i >= 0; i--) {
printf("%d ", tableau[i]);
}
printf("\n");
return 0;
}