{"id":5549,"date":"2023-09-22T04:01:00","date_gmt":"2023-09-22T04:01:00","guid":{"rendered":"http:\/\/ebhor.com\/?p=5549"},"modified":"2023-09-22T09:44:59","modified_gmt":"2023-09-22T09:44:59","slug":"addition-of-two-matrix-in-c-programming","status":"publish","type":"post","link":"https:\/\/www.ebhor.com\/addition-of-two-matrix-in-c-programming\/","title":{"rendered":"Addition of Two Matrix in C Programming"},"content":{"rendered":"\n
A Matrix is Two dimensional array<\/a> that have number of rows and columns. Addition of Two Matrix in C Programming is very easy.<\/p>\n\n\n\n To write program for adding two matrix is same as we perform matrix addition<\/a> in mathematics.<\/p>\n\n\n\n To Add Two Numbers rows and columns of both matrix should be same.<\/p>\n\n\n\n Element of each row and column of matrix A will added with same row and column element in matrix B.<\/p>\n\n\n\n The sum of both matrix will produce same row and column matrix in resultant matrix.<\/p>\n\n\n\n Example:<\/strong> Write a program to add two matrix. Firstly, ask from user order of matrix( number of rows and column). <\/p>\n\n\n\n Then take the elements of matrix from user as a input and print the resultant matrix<\/p>\n\n\n\n For example, <\/p>\n\n\n\n if a user input order as 3,3, i.e., three rows and three columns and Second matrix:<\/strong> Steps for Addition of Two Matrix in C Programming<\/p>\n\n\n\n Number of rows and columns are controlled by variable m and n.<\/p>\n\n\n\n To avoid checking again row and column of both matrix it is accepted at only one place and used by both matrix.<\/p>\n\n\n\n Both Matrix elements are taken from user as per requirement user can also declare matrix elements in program.<\/p>\n\n\n\n OUTPUT<\/strong><\/p>\n\n\n\n Hope you got how to add two matrix in C. Similar way you can also write program to multiply two matrix.<\/p>\n","protected":false},"excerpt":{"rendered":" A Matrix is Two dimensional array that have number of rows and columns. Addition of Two Matrix in C Programming is very easy. To write program for adding two matrix is same as we perform matrix addition in mathematics. To Add Two Numbers rows and columns of both matrix should be same. Element of each … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[283],"tags":[93,282],"yoast_head":"\n
First matrix <\/strong>
1 2 3
4 5 6
7 8 9<\/strong>
<\/p>\n\n\n\n
9 8 7
6 5 4
3 2 1<\/strong>
<\/p>\n\n\n\n
then the output of the program (addition of two 3*3 matrix in c) is:
10 10 10
10 10 10
10 10 10<\/strong><\/p>\n\n\n\n\n
Matrix addition program in C<\/strong><\/h2>\n\n\n\n
\n#include
Enter the number of rows and columns of matrix\n\n3\n3\nEnter the elements of first matrix\n2\n3\n4\n5\n6\n7\n8\n9\n10\nEnter the elements of second matrix\n11\n12\n13\n14\n15\n16 \n17\n18\n19\n\n\nSum of matrices= \n13\t15\t17\t\n19\t21\t23\t\n25\t27\t29\t\n\n<\/pre>\n\n\n\n