Skip to content

Instantly share code, notes, and snippets.

@piqueprajwal
Created June 6, 2018 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piqueprajwal/af2e3193579e64ade714ca7a2159dff9 to your computer and use it in GitHub Desktop.
Save piqueprajwal/af2e3193579e64ade714ca7a2159dff9 to your computer and use it in GitHub Desktop.
programmingfaster.com
#include<iostream>
//using namespace std;(for codeblocks user)
int main()
{
int a[2][3], b[2][3], c[2][3],i,j;
cout<<"enter elements of first matrix"<<endl;
for (i=0;i<2;i++)
{
for (j=0;j<3;j++)
{
cout<<"a"<<i<<j<<"=";
cin>>a[i][j];
}
}
cout<<"enter elements of second matrix"<<endl;
for (i=0;i<2;i++)
{
for (j=0;j<3;j++)
{
cout<<"b"<<i<<j<<"=";
cin>>b[i][j];
}
}
for (i=0;i<2;i++)
{
for (j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
cout<<"result="<<endl;
for (i=0;i<2;i++)
{
for (j=0;j<3;j++)
{
cout<<"c"<<i<<j<<"=";
cout<<c[i][j];
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment