Matrices
#include
#include
void main (void)
{
clrscr();
int A[15][15],B[15][15],C[15][15],row1,col1,row2,col2,i,j;
printf (" Enter no. of rows and colums of First matrix :\n");
scanf("%d%d",&row1,&col1);
printf("enter no. of rows and coloums of Second matrix :\n");
scanf("%d%d",&row2,&col2);
if(row1==row2&&col1==col2)
{
for(i=0;i
{
for(j=0;j
{
printf("Enter numbers for Matrice A = ");
scanf("%d",&A[i][j]);
}
}
for(i=0;i
{
for(j=0;j
{
printf("Enter numbers for Matrice B = ");
scanf("%d",&B[i][j]);
}
}
for (i=0;i
{
for(j=0;j
{
C[i][j]=A[i][j]+B[i][j];
printf(" %d ",C[i][j]);
}
printf("\n");
}
}
else printf("\nAddition Is NOT Possible !");
getch();
}
#include
void main (void)
{
clrscr();
int A[15][15],B[15][15],C[15][15],row1,col1,row2,col2,i,j;
printf (" Enter no. of rows and colums of First matrix :\n");
scanf("%d%d",&row1,&col1);
printf("enter no. of rows and coloums of Second matrix :\n");
scanf("%d%d",&row2,&col2);
if(row1==row2&&col1==col2)
{
for(i=0;i
{
for(j=0;j
{
printf("Enter numbers for Matrice A = ");
scanf("%d",&A[i][j]);
}
}
for(i=0;i
{
for(j=0;j
{
printf("Enter numbers for Matrice B = ");
scanf("%d",&B[i][j]);
}
}
for (i=0;i
{
for(j=0;j
{
C[i][j]=A[i][j]+B[i][j];
printf(" %d ",C[i][j]);
}
printf("\n");
}
}
else printf("\nAddition Is NOT Possible !");
getch();
}
Comments
Post a Comment