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

ADDMAT

This C program performs the addition of two matrices A and B. It prompts the user to input the dimensions and elements of both matrices, calculates their sum, and then displays the resulting matrix C. The program includes functions for input, output, and matrix addition operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ADDMAT

This C program performs the addition of two matrices A and B. It prompts the user to input the dimensions and elements of both matrices, calculates their sum, and then displays the resulting matrix C. The program includes functions for input, output, and matrix addition operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

//C program for addition of two matrices

#include<stdio.h>
void main()
{
int A[10][10],B[10][10],C[10][10],m,n,i,j;
clrscr();
printf("enter the rows and columns of A and B matrix\n");
scanf("%d%d",&m,&n);
printf("Enter the elements of A Matrix \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&A[i][j]);
}
}
printf("Printing the elementa of A-Matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",A[i][j]);
}
printf("\n");
}
printf("Enter the elements of B-Matrix \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&B[i][j]);
}
}
printf("Printing the elementa of B-Matrix \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",B[i][j]);
}
printf("\n");
}
//Addition of A and B matrices
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
C[i][j]=A[i][j]+B[i][j];
}
}
printf("The resultant addition matrix is \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",C[i][j]);
}
printf("\n");
}
getch();
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy