0% found this document useful (0 votes)
0 views

Addition Matix

Uploaded by

Omyaa0000
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Addition Matix

Uploaded by

Omyaa0000
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Addition matix

#include<stdio.h>

/*
Matrix ADDITION
BY:-AYS
*/

int main()
{
int a[10][10], b[10][10], add[10][10];
int r,c,i,j;

printf("\nEnter the number of rows : ");


scanf("%d",&r);
printf("\nEnter the number of columns :
");
scanf("%d",&c);

printf("\nEnter the first matrix elements


\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}

printf("\nEnter the second matrix


elements \n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&b[i][j]);
}
}

printf("\nAddition of the 2 Matrix\n");


for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
add[i][j]=a[i][j] + b[i][j];
printf("%d\t",add[i][j]); //for
printing result
}
printf("\n");
}
return 0;

You might also like