#include <stdio.h>
#define RIGHE 3
#define COLONNE 4
int main(){
int matrice[RIGHE][COLONNE];
int i , j,somma_0c=0,somma_1c=0,somma_2c=0,somma_3c=0;
int somma_0r=0,somma_1r=0,somma_2r=0,SOMMA_MATRICE;
printf("\ninserisci gli elementi in posizione");
for(i=0;i < RIGHE;i++){
for(j=0;j < COLONNE;j++){
printf("\n%d e %d",i,j);
scanf("%d",&matrice[i][j]);}
}
j=0;
for(i=0;i < RIGHE;i++)
somma_0c += matrice[i][j];
j=1;
for(i=0;i < RIGHE;i++)
somma_1c+= matrice[i][j];
j=2;
for(i=0;i < RIGHE;i++)
somma_2c+= matrice[i][j];
j=3;
for(i=0;i < RIGHE;i++)
somma_3c += matrice[i][j];
printf("\nla somma delle colonne in ordine e \n1.c. %d \n2.c %d \n3.c %d \n4.c %d ",somma_0c,somma_1c,somma_2c,somma_3c);
i=0;
for(j=0;j < COLONNE;j++)
somma_0r += matrice[i][j];
i=1;
for(j=0;j < COLONNE;j++)
somma_1r += matrice[i][j];
i=2;
for(j=0;j < COLONNE;j++)
somma_2r += matrice[i][j];
printf("\nla somma delle righe in ordine e \n1.r. %d \n2.r %d \n3.r %d ",somma_0r,somma_1r,somma_2r);
SOMMA_MATRICE=somma_0r + somma_1r + somma_2r;
printf("\nla somma della matrice:\n è %d",SOMMA_MATRICE);
return 0; }
To embed this project on your website, copy the following code and paste it into your website's HTML: