No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Email :
*
Password :
*
Remember me
Forgot password?
Login using
C# Corner
In Focus
C# Corner
Contribute
An Article
A Blog
A News
A Video
A Link
An Interview Question
Ask a Question
TECHNOLOGIES
.NET
C#
Hiring and Recruitment
Mobile Development
SignalR
.NET Core
C# Corner
HoloLens
Networking
Software Testing
.NET Standard
C, C++, MFC
How do I
Node.js
SQL Language
Active Directory
Career Advice
Internet & Web
Office Development
SQL Server
ADO.NET
CIO
Internet of Things
Open Source
TypeScript
Agile Development
Cloud
Java
Operating Systems
Unity
AJAX
Coding Best Practices
Java and .NET
Power BI
UWP
Android
Cognitive Services
JavaScript
Progressive Web Apps
Visual Studio
Angular
Cyber Security
JQuery
Python
WCF
Artificial Intelligence
Databases & DBA
JSON
Q#
Web Development
ASP.NET
Design Patterns & Practices
Knockout
R
Web Services
ASP.NET Core
DevOps
kotlin
React
Windows Forms
Azure
Dynamics CRM
Leadership
Security
Windows PowerShell
Blockchain
Entity Framework
LINQ
Servers
WPF
Bootstrap
Flutter
Machine Learning
SharePoint
Xamarin
Bot Framework
Google Development
Microsoft 365
Request a new Category
|
View All
ANSWERS
BLOGS
VIDEOS
INTERVIEWS
BOOKS
NEWS
EVENTS
CHAPTERS
ANNUAL CONFERENCE
Mathura Conference
Xamarin DevCon
Delhi Conference
Startup Conference
Hyderabad Conference
Chandigarh Conference
CAREER
JOBS
TRAINING
MORE
Consultants
IDEAS
LINKS
STUDENTS
MEMBERS
STORIES
Certifications
Adding Two Matrices In C
Shobana J
Jul 25
2016
Blog
1
0
4.3
k
facebook
twitter
linkedIn
google Plus
Reddit
WhatsApp
Email
Bookmark
expand
matrix.zip
Introduction
In this blog, I am going to explain how to add two matrices in C programming, by entering the order of matrix.
Software Requirements
Turbo C++ or C.
Programming
#include < stdio.h >
int
main()
{
int
m, n, c, d, first[10][10], second[10][10], sum[10][10];
printf(
"Enter the number of rows and columns of matrix\n"
);
scanf(
"%d%d"
, & m, & n);
printf(
"Enter the elements of first matrix\n"
);
for
(c = 0; c < m; c++)
for
(d = 0; d < n; d++) scanf(
"%d"
, & first[c][d]);
printf(
"Enter the elements of second matrix\n"
);
for
(c = 0; c < m; c++)
for
(d = 0; d < n; d++) scanf(
"%d"
, & second[c][d]);
printf(
"Sum of entered matrices:-\n"
);
for
(c = 0; c < m; c++)
{
for
(d = 0; d < n; d++)
{
sum[c][d] = first[c][d] + second[c][d];
printf(
"%d\t"
, sum[c][d]);
}
printf(
"\n"
);
}
return
0;
}
Explanation
By the above programming, the sum of two matrices can be printed successfully.
Output
Add Two Matrix
C
X
Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.
Start Learning Now