Write a Program to Add two 5x5 Matrix using C



5x5 Matrix, C,Addition, Sumit Kar, Timus Rak





#include<stdio.h>


void main()

{

  int a[5][5],b[5][5],c[5][5];

  int i,j;


  for(i=0;i<5;i++)

  {

    printf("\nEnter elements of %d row of first Matrix: ",i+1);

    for(j=0;j<5;j++)

      scanf("%d",&a[i][j]);

  }


  for(i=0;i<5;i++)

  {

    printf("\nEnter elements of %d row of second Matrix: ",i+1);

    for(j=0;j<5;j++)

      scanf("%d",&b[i][j]);

  }


  printf("\nSum of Matrix:\n\n");

  for(i=0;i<5;i++)

  {

    for(j=0;j<5;j++)

    {

      c[i][j]=a[i][j]+b[i][j];

      printf("%3d ",c[i][j]);

    }

    printf("\n");

  }








}


0 Comments