Thursday, May 20, 2010

write a program to add two matrix

//Author Subhasis Nayak(MCA,BBA,G-TECH)
//date:-20-05-2010
/*ADDING TWO MATRIX */
/*write a program to add two matrix */
/*proghramming language C++*/
#include
#include
int main(){
int i,j;
int arFirst[3][3];
int arSecon[3][3];
//takes values for first matrix from user
cout<<"Enter the value for the First Matrix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cin>>arFirst[i][j];
        }
    }


//displaying the the first matrix
cout<<"Displaying the First Matix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cout<<<"\t";
        }
    cout<
    }
//take value for second matrix
cout<<"Enter the value for the Second Matrix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cin>>arSecon[i][j];
        }
    }
//displaying second matrix
cout<<"Displaying the second Matix\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cout<<<"\t";
        }
    cout<
    }
//Dispaying the result
cout<<"Adding First And Second Matrix & displaying\n";
for(i=0;i<3;i++){
    for(j=0;j<3;j++){
        cout<<<"\t";
        }
    cout<
    }
getch();
clrscr();
return 0;
}

No comments:

Post a Comment