Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
//assuming that max. rows and columns are 10,10 respectively void RowColSum (float A[10][10],int r,int c) { int i,j; float RS[RS], CS[10]; //find row sum for (i=0; i <r; i++) { RS [i]=0; for (j=0 ; j <c ; j++) RS [i]+=A[i][j]; } //find column sum for (j=0 ; j <c ; j++) { CS [j]=0; for (i=0 ; i <r ; i++) CS [j]+=A [i][j]; } //Display 2-D array with roes and columns for ( i=0 ; i <r ; i++) { for ( j=0 ; j <c ; j++) cout <<A[i][j]<<'t'; cout <<RS [i]<<endl; } for (j=0 ; j <c ; j++) cout <<CS [j]<<'\t' ; cout <<endl; } Its a bit lengthy but easy to understand, just concentrate and understand HOPE this help you PEACE \/
21st Dec 2016, 8:19 PM
Usman khan
Usman khan - avatar