sign up I login
 advanced
refer a friend - earn nickels!!

Ask & Discuss Questions with Community & Experts

Moderation Team
Ask iit jee aieee pet cbse icse state board community Discussion Response Post to: C++......
Forum Index -> Games, Puzzles and Quizzes -> View Full Question like the article? email it to a friend.  
Author Message
antonyajay21 (497)

Blazing goIITian

Olaaa!! Perrrfect answer. 91  [112 rates]

antonyajay21's Avatar

total posts: 319    
offline Offline
        /*Program to add two matrices*/
#include<iostream.h>
#include<conio.h>
void main()
{
int a[5][5],b[5][5],c[5][5],row,column,i,j,k,l;
clrscr();
cout<<"Enter the rows of the matrices\n";
cin>>row;
cout<<"Enter the columns of the matrices\n";
cin>>column;
cout<<"Enter the elements of the first matrix";
for(i=1;i<=row;i++)
{
    cout<<"\n";
    for(j=1;j<=column;j++)
    {
    cout<<"Enter the "<<i<<"\t"<<j <<"element";
    cin>>a[row][column];
    }
}
cout<<"Enter the elements of the second matrix";
for(k=1;k<=row;k++)
{
    cout<<"\n";
    for(l=1;l<=column;l++)
    {
    cout<<"Enter the "<<k<<"\t"<<l<<" element";
    cin>>b[row][column];
    }
}
cout<<"The sum of the matrices is\n";
for(int x=1;x<=row;x++)
{
    cout<<"\n";
    for(int y=1;y<=column;y++)
    {
    c[row][column]=a[x][y]+b[x][y];
    cout<<c[row][column];
    }
}
getch();
}


Be not afraid of growing slowly.
Be afraid only of standing still.

 this reply: 5 points  (with Olaaa!! Perrrfect answer.   in 1 votes )   [?]
 
You have to be logged on to rate
  
 

Top Offers for goIITians
Correspondence Courses
Brilliant Tutorials
Narayana Institute
Aakash Institute
Classroom/Crash Courses
Narayana - Kota , Delhi , Others
Brilliant Tutorials - Class , Crash
Aakash Institute - Medical , Engg
Online Test Series
Brilliant Tutorials
Narayana Institute
Aakash Institute
Mahesh Tutorials
AMITY      Sri Chaitanya