#include<iostream.h>
#include<conio.h>
#define r 3
#define c 3
void main(){
int A[r][c],B[r][c],C[r][c],i,j;
clrscr();
cout<<"Enter Elements of Matrix A"<<endl;
for(i=0;i<r;i++){
for(j=0;j<c;j++){
cout<<"A["<<i<<"]"<<"["<<j<<"]=";
cin>>A[i][j];
}}
cout<<"Enter Elements of Matrix B"<<endl;
for(i=0;i<r;i++){
for(j=0;j<c;j++){
cout<<"B["<<i<<"]"<<"["<<j<<"]=";
cin>>B[i][j];
}}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
C[i][j]=A[i][j]-B[i][j];
}}
cout<<"Subtraction of two Matrix is:- "<<endl;
for(i=0;i<r;i++){
for(j=0;j<c;j++){
cout<<C[i][j]<<" ";
}
cout<<endl;
}
getch();
}
No comments:
Post a Comment