Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Tuesday, December 30, 2008

c program to add two m x n matrices and store the results in a third matrix

c program to add two m x n matrices and store the results in a third
matrix.

#include
#include
#define m 5
#define n 5
void main()
{
int i,j,k,a[m][n],b[m][n],c[m][n];
int m1,m2,n1,n2;
clrscr();
printf("\nEnter No Of Rows For A Matrix(less than 6)==");
scanf("%d",&m1);
printf("\nEnter No Of Columns For A Matrix(less than 6)==");
scanf("%d",&n1);
printf("\nEnter No Of Rows For B Matrix(less than 6)==");
scanf("%d",&m2);
printf("\nEnter No Of Columns For B Matrix(less than 6)==");
scanf("%d",&n2);
if(m1!=m2 || n1!=n2)
{
printf("\nPlease Enter Equal Rows And Equal Columns For Both Matrix\n");
getch();
exit(0);
}
else
{ printf("\nEnter Numbers For Matrix A\n");
for(i=0;i for(j=0;j scanf("%d",&a[i][j]);
printf("\nEnter Numbers For Matrix B\n");
for(i=0;i for(j=0;j scanf("%d",&b[i][j]);

for(i=0;i for(j=0;j c[i][j]=a[i][j]+b[i][j];
}
printf("\nMatrix After Addition\n");
for(i=0;i {
printf("\n");
for(j=0;j {
if(c[i][j]<10) //for alignment
printf("%d ",c[i][j]);
else
printf("%d ",c[i][j]);
}
}
getch();
}
/*Output
Enter No Of Rows For A Matrix(less than 6)==3

Enter No Of Columns For A Matrix(less than 6)==3

Enter No Of Rows For B Matrix(less than 6)==3

Enter No Of Columns For B Matrix(less than 6)==3

Enter Numbers For Matrix A
1
2
3
4
5
6
7
8
9

Enter Numbers For Matrix B
10
11
12
13
14
15
16
17
18

Matrix After Addition

11 13 15
17 19 21
23 25 27 */

c program to add two m x n matrices and store the results in a third matrixSocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG