Add affichage tableau
This commit is contained in:
parent
28887a04d7
commit
0dbdf7cd79
2 changed files with 24 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,3 +22,4 @@ tables-multiplication
|
|||
triangle-des-etoiles
|
||||
factorielle
|
||||
calculatrice
|
||||
affichage-tableaux
|
||||
|
|
23
programmation-c-cpp/tp3/affichage-tableaux.c
Normal file
23
programmation-c-cpp/tp3/affichage-tableaux.c
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue