Comments

Wednesday, October 17, 2012

Using two dimensional array Subtract two matrix.

Posted by at 8:51 AM Read our previous post


Object
1-      Using two dimensional  array adding two matrix.

Source code

#include <iostream>
using namespace std;
void main()
{
int ans;
int matrix[3][3]=
                           {
                                  {3,0,8},
                                  {2,4,2},
                                  {1,3,5}
                                                        };
int matrix2 [3][3]={
                                  {1,2,3},                         
                                  {4,2,3},
                                  {3,2,1}};
       cout<<"Product of matrix is   "<<endl;                                           
   for(int a=0;a<3;a++)
       {
      
        {  for(int b=0;b<3;b++)
               
                //adding simple matrix
                cout<<matrix[a][b]-matrix2[a][b]<<"  ";
               
              }
                cout<<endl;
        }
}

                             


Output

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template