1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include <stdio.h>
int main()
{
int tab[5][3], sommedeslignes[5];
int ligne, j;
for(ligne = 0; ligne < 5; ligne++)
{
printf("Ligne %d\n", ligne + 1); /* t[0] --> Ligne 1, ... */
for(j = 0; j < 3; j++)
{
printf("t[%d][%d] = ", ligne, j);
scanf("%d", &(tab[ligne][j]));
}
printf("\n");
}
for(ligne = 0; ligne < 5; ligne++)
{
sommedeslignes[ligne] = 0;
for(j = 0; j < 3; j++)
sommedeslignes[ligne] += tab[ligne][j];
printf("sommedeslignes[%d] = %d\n", ligne, sommedeslignes[ligne]);
}
return 0;
} |
Partager