#include<iostream.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3],i,j;
clrscr();
cout<<"\n Enter The Elements Of Matrix A: \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}
cout<<"\n Enter The Elements Of Matrix B: \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
cout<<"\n Addition of Both Matrix is: \n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<"\t"<<c[i][j];
}
cout<<"\n";
}
getch();
}
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3],i,j;
clrscr();
cout<<"\n Enter The Elements Of Matrix A: \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}
cout<<"\n Enter The Elements Of Matrix B: \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
cout<<"\n Addition of Both Matrix is: \n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<"\t"<<c[i][j];
}
cout<<"\n";
}
getch();
}
No comments:
Post a Comment