problem no.3
- write a program using two dimentional arrays that
compute
the sum of data in rows and sum of data in columns of
the 3*3 array variable.

sample input/output dialog

5 9 8 = 22
3 8 2 = 13
4 3 9 = 16
_____________
12 20 19

Answer Posted / rana from hriyana

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],rowsum[3],colsum[3];
clrscr();

for(i=0;i<3;i++)
rowsum[i]=colsum[i]=0;

printf("Enter numbers in a 3x3 matrix:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
rowsum[i]+=a[i][j];
colsum[j]+=a[i][j];
}


for(i=0;i<3;i++)
printf("RowSum[%d]:%d\n",i,rowsum[i]);

for(i=0;i<3;i++)
printf("Columnsum[%d]:%d\n",i,colsum[i]);

getch();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a script to delete all the files in a folder except one desired file.

1001


how exactly is the lngColour used?

1876


create a .dll component operation and use created component in another project. required methods events and properties. connect, add,search,data report

2181