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

Answers were Sorted based on User's Feedback



problem no.3 - write a program using two dimentional arrays that compute the sum of data in..

Answer / maddy

/*the snippet for the problem is consider arr[10][10],read
the co-ordinates from the user col[10],row[10]*/
for(i=0;i<n;i++)//where n is co-ordinte
{
for(j=0;j<n;j++)
{
row[i]+=arr[i][j];//getting each element in the row
col[i]+=arr[j][i];//getting each element in column
}
}

Is This Answer Correct ?    12 Yes 4 No

problem no.3 - write a program using two dimentional arrays that compute the sum of data in..

Answer / sreejesh1987

#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 ?    5 Yes 2 No

problem no.3 - write a program using two dimentional arrays that compute the sum of data in..

Answer / 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

problem no.3 - write a program using two dimentional arrays that compute the sum of data in..

Answer / janel

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int ar[3][3];
int a,b,R1,R2,R3,C1,C2,C3;

cout<<"Please Enter 9 numbers:"<<endl;
for (a=0;a<3;a++){
for (b=0;b<3;b++){

cout<<"["<<a<<"]["<<b<<"]:";
cin>>ar[a][b];
}
}
cout<<"The sum of the first row is: ";
R1=ar[0][0]+ar[0][1]+ar[0][2];
cout<<R1;
cout<<"\nThe sum of the second row is: ";
R2=ar[1][0]+ar[1][1]+ar[1][2];
cout<<R2;
cout<<"\nThe sum of the third row is: ";
R3=ar[2][0]+ar[2][1]+ar[2][2];
cout<<R3;

cout<<"\nThe sum of the first column is: ";
C1=ar[0][0]+ar[1][0]+ar[2][0];
cout<<C1;
cout<<"\nThe sum of the second column is: ";
C2=ar[0][1]+ar[1][1]+ar[2][1];
cout<<C2;
cout<<"\nThe sum of the third column is: ";
C3=ar[0][2]+ar[1][2]+ar[2][2];
cout<<C3<<endl;
getch();
system("pause");
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Visual Basic Code Interview Questions

Write a Program in Visual Basic by means of which we can send any data from Visual basic program to any other application running on that machine whether that application supports OLE or not.....

1 Answers  


I need help for Source Code & design of my school thesis enrollment system using visual basic 6.0/2008 database MS Access 2007. Please help me friends...Thanks...

1 Answers  


Write a code snippets to find greatest and least of any number of inputs without taking the help of array

1 Answers   Infosys, Wipro,


I have string str="Arts And Props" now i want to replace space in string with null. means i want result as str="ArtsAndProps"

1 Answers  


how to generate Question paper and how to save pattern of question paper

2 Answers  






write a program to create a notepad using common dialog control and rich text box.

1 Answers  


how exactly is the lngColour used?

0 Answers  


swap two no without using third variable

7 Answers  


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

4 Answers   CSS,


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

0 Answers  


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

0 Answers  


Categories