Twitter Feed Facebook Google Plus Youtube

Adsense responsive

Recent Post below header

Wednesday, 30 January 2013

C PROGRAM: TO ADD TWO MATRICES USING ARRAY

CODING:
#include<stdio.h>
#include<conio.h>
void main( )
{
int a[10][10],b[10][10],c[10][10],m,n,i,j;
clrscr( );
printf("Enter order of matrices ");
scanf("%d%d",&m,&n);
printf("Enter values of first matrix\n);
for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
 {
  printf("Enter values of a[%d][%d] ",i,j);
  scanf("%d",&a[i][j]);
 }
}
printf(\nEnter values of second matrix\n);
for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
 {
  printf("Enter values of b[%d][%d] ",i,j);
  scanf("%d",&b[i][j]);
 }
}
for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
 {
  c[i][j]=a[i][j]+b[i][j];
  printf("\nSum of a[%d][%d] and b[%d][%d] = %d",i,j,i,j,c[i][j]);
 }
}
getch( );
}

----------------------------------------------------------------------------------------------------------------------------
OUTPUT:

OUTPUT WINDOW

For any query or suggestion please comment below....

1 comment: