#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int A[20][2],n,sum;
cout<<"\n\tEnter the no. of terms: ";
cin>>n;
cout<<"\n\tEnter "<<2*n<<" numbers to the "<<n<<"*2 array: ";
for(int i=0;i<2;i++)
{ for(int j=0;j<n;j++)
cin>>A[i][j];
}
cout<<"\n\n\tThe Array you entered is: ";
for(i=0;i<2;i++)
{ cout<<"\n";
{ for(int j=0;j<n;j++)
cout<<A[i][j]<<" ";
}
}
for(i=0;i<2;i++)
{ sum=0;
for(int j=0;j<n;j++)
sum+=A[i][j];
cout<<"\n\tSum of row "<<i+1<<" is "<<sum;
}
cout<<"\n";
for(i=0;i<n;i++)
{ sum=0;
for(int j=0;j<2;j++)
sum+=A[j][i];
cout<<"\n\tSum of column "<<i+1<<" is "<<sum;
}
getch();
}
Captain Neo
0
Newbie Poster
Recommended Answers
Jump to PostIs that not supposed to happen? If not, why did you code it that way?
Read this http://www.daniweb.com/software-development/cpp/threads/78223 and ask again.
All 3 Replies
Moschops
683
Practically a Master Poster
Featured Poster
PrimePackster
10
Runaway Poster
PrimePackster
10
Runaway Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.