ThinkTronix
learning is fun...
Home
Home
E-Books
Robotics
Coding
C++
Tutorials
Robotics
Softwares
Social Profiles
Popular
Tags
Blog Archives
Popular Posts
Volume of a Cube, Cuboid & Cylinder using Function Overloading
Write a Program to find Volume of a Cube, Cuboid & Cylinder using Function Overloading. #include<iostream> using namespace std...
Robotics: Using Atmega16 Microcontroller - Introduction
What is a Microcontroller? A microcontroller is a single chip, self-contained computer which incorporates all the basic components of...
NI Multisim 11.0
NI Multisim (formerly MultiSIM ) is an electronic schematic capture and simulation program which is part of a suite of circuit desi...
Area using Default Arguments
Write a Program to find Area of a Square & Rectangle using Default Arguments. #include<iostream> using namespace std; int sqr(...
Swap using Call by Address.
Write a Program to enter two no.s and swap their values using Call by Address. #include<iostream> using namespace std; void swap(i...
Tags
C++ code
electronics
free download
free ebooks
mediafire
programming
software
video
Blog Archive
▼
2012
(24)
►
May
(1)
►
April
(3)
►
February
(6)
▼
January
(14)
Volume of a Cube, Cuboid & Cylinder using Function...
Swap using Call by Address.
Swap using Call by Value
Swap using Call by Reference
Sum of Digits
Inline Function
Default Argument
Pattern -3
Pattern - 2
Pattern -1
Palindrome String
Palindrome Number
Matrix Multiplication
Matrix Addition
►
2011
(2)
►
December
(2)
Wednesday, January 25, 2012
Matrix Multiplication
10:01 PM
C++ code
,
matrix multiplication
No comments
Write a Program to enter two matrices and print their Product.
#include<iostream> using namespace std; int main() { int a[5][5],b[5][5],c[7][7],i,j,k,r1,c1,r2,c2; cout<<"Enter the order of first matrix:"; cin>>r1>>c1; cout<<"Enter the order of second matrix:"; cin>>r2>>c2; if(c1!=r2) { cout<<"Multiplication not possible.\n"; return 0; } cout<<"Enter the first matrix:\n"; for(i=0;i<r1;i++) for(j=0;j<c1;j++) cin>>a[i][j]; cout<<"Enter the second matrix:\n"; for(i=0;i<r2;i++) for(j=0;j<c2;j++) cin>>b[i][j]; for(i=0;i<r1;i++) for(j=0;j<c2;j++) c[i][j]=0; for(i=0;i<r1;i++) for(j=0;j<c2;j++) for(k=0;k<c1;k++) c[i][j]+=a[i][k]*b[k][j]; cout<<"The product matrix is:\n"; for(i=0;i<r1;i++) { for(j=0;j<c2;j++) cout<<c[i][j]<<" "; cout<<"\n"; } return 0; }
Email This
BlogThis!
Share to X
Share to Facebook
Newer Post
Older Post
Home
0 comments:
Post a Comment
0 comments:
Post a Comment