Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

1280


how exactly is the lngColour used?

2113


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

2455