Program for Matrix Addition and Subtraction

# include <stdio.h>
#include<conio.h>
main ( )
{
int a[3][3],b[3][3],c[3][3],d[3][3],i,j;
printf(“enter elements into matrix a”);
for ( i = 0; i < 3; i + + )
for ( j = 0; j < 3; j ++)
scanf( “%d”, &a[i][j]);
printf(“enter elements into matrix b”);
for ( i = 0; i < 3; i ++ )
for ( j =0; j < 3 ; j ++)
scanf (“%d” &b[i][j]);
printf(“addition matrix is \n”);
for ( i = 0 ; i < 3; i ++)
{
  for ( j =0; j < 3 ; j ++)
  {
   c [i][j]=a[i][j]+b[i][j];
   printf (“%d\t”, c[i][j]);
  }
printf ( “\n”);
}
printf (“difference matrix is \n”);
for (i = 0; i < 3; i++)
{
  for (j = 0, j < 3; j++)
   {
    d[i] [j] = a [i][j] –b[i][j];
    printf (“%d \t”, d[i][j]);

  }
printf(“\n”);
}
getch();
}


Related

C Programs 4432107616253503648

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item