|
|
|
|
|
| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 18 Feb 2008 13:26:02 IST
|
|
|
/*Program to add two matrices*/ #include<iostream.h> #include<conio.h> void main() { int a[5][5],b[5][5],c[5][5],row,column,i,j,k,l; clrscr(); cout<<"Enter the rows of the matrices\n"; cin>>row; cout<<"Enter the columns of the matrices\n"; cin>>column; cout<<"Enter the elements of the first matrix"; for(i=1;i<=row;i++) { cout<<"\n"; for(j=1;j<=column;j++) { cout<<"Enter the "<<i<<"\t"<<j <<"element"; cin>>a[row][column]; } } cout<<"Enter the elements of the second matrix"; for(k=1;k<=row;k++) { cout<<"\n"; for(l=1;l<=column;l++) { cout<<"Enter the "<<k<<"\t"<<l<<" element"; cin>>b[row][column]; } } cout<<"The sum of the matrices is\n"; for(int x=1;x<=row;x++) { cout<<"\n"; for(int y=1;y<=column;y++) { c[row][column]=a[x][y]+b[x][y]; cout<<c[row][column]; } } getch(); }
|
Be not afraid of growing slowly.
Be afraid only of standing still.
 |
this reply: 5 points
(with 1 
in 1 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
|
|
|
|
|
|
|