|
Answer» hello guys, i want help in c program. 1 3 4 5 2 3 4 7 8. this is question given and i want this
1 3 4 |8 5 2 3 |10 4 7 8 |19 .................|......... 10 12 15 |37 as a answer. sum of rows and column and also grand sum. i almost did it but not get gull success. i did sum of rows and column but not know how i do grand sum. here is coding that i did.
\*****starting of coding****\
#include #include void MAIN() { int a[3][3],i,j,b,c; printf("enter matrix"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf("%d",&a[j]); } } for(i=0;i<3;i++) { b=0;c=0; for(j=0;j<3;j++) { b=b+a[j]; c=c+a[j]; } printf("\n"); printf("%d\t%d",b,c); } getch(); } \****** end of coding*****\
after running this i got answer 8 10 19 sum of rows and 10 12 15 sum for column
first post is wrong so i did correction
hello guys, i want help in c program. 1 3 4 5 2 3 4 7 8. this is question given and i want this
1 3 4 |8 5 2 3 |10 4 7 8 |19 .................|......... 10 12 15 |37 as a answer. sum of rows and column and also grand sum. i almost did it but not get gull success. i did sum of rows and column but not know how i do grand sum. here is coding that i did. Code: [Select]\*****starting of coding****\
#include<stdio.h> #include<conio.h> void main() { int a[3][3],i,j,b,c; printf("enter matrix"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf("%d",&a[j]); } } for(i=0;i<3;i++) { b=0;c=0; for(j=0;j<3;j++) { b=b+a[i][j]; c=c+a[j][i]; } printf("\n"); printf("%d\t%d",b,c); } getch(); } \****** end of coding*****\
after running this i got answer 8 10 19 sum of rows and 10 12 15 sum for column
|