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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| #include <stdio.h>
#include <stdlib.h>
int main(void) {
int tab[3][5], sommedeslignes[3],sommedescolonnes[5];
int i,j,fin;
for(j=0; j<5; j++)
{
for(i=0; i<3; i++)
{
printf("entrer les valeurs\n");
scanf("%d",&tab[i][j]);
}
}
for (i=0;i<3;i++)
{
sommedeslignes[i]=0;
for (j=0;j<5;j++)
{
sommedeslignes[i]=sommedeslignes[i]+tab[i][j];
}
}
for(i=0; i<3; i++)
{
for (j=0; j<5; j++)
{
printf("%d ",tab[i][j]);
}
printf("%d\n",sommedeslignes[i]);
}
for (j=0;j<5;j++)
{
sommedescolonnes[j]=0;
for (i=0;i<3;i++)
{
sommedescolonnes[j]=sommedescolonnes[j]+tab[j][i];
}
}
for(j=0; j<5; j++)
{
for (i=0; i<3; i++)
{
printf("%d ",tab[j][i]);
}
printf("%d\n",sommedescolonnes[j]);
}
scanf("%d",&fin);
} |
Partager