SlideShare a Scribd company logo
s1-1
Write a program in `C’ language that accepts two matrices as input and prints
their product.
#include <stdio.h>
#include <conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,k,m,n,p,q;
clrscr();
printf("Enter the order of the first matrixn");
scanf("%d%d",&m,&n);
printf("Enter the order of the second matrixn");
scanf("%d%d",&p,&q);
if(n!=p)
printf("The matrix can not be multipliedn");
else
{
printf("Enter the elements of the first matrixn");
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("Enter the elements of the second matrixn");
for(i=0;i<p;i++)
for(j=0;j<q;j++)
scanf("%d",&b[i][j]);
for(i=0;i<m;i++)
for(j=0;j<q;j++)
{
c[i][j]=0;
for(k=0;k<n;k++)
c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
}
printf("The resultant matrix of multiplication:n");
for(i=0;i<m;i++)
{
for(j=0;j<q;j++)
printf("%dt",c[i][j]);
printf("n");
}
}
getch();
}
Page 1

More Related Content

What's hot (20)

PDF
Program in ‘C’ language to implement linear search using pointers
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s3-2
Dr. Loganathan R
 
DOCX
One dimensional operation of Array in C- language
9096308941
 
PPTX
Computer programing w
cexpertise
 
PDF
Odd number
Ankit Dubey
 
PDF
C Programming Example
PRATHAMESH DESHPANDE
 
PPTX
C Programming Example
University of Potsdam
 
PDF
Insertion sort
Hitesh Kumar
 
DOC
Add digits of number in c
mohdshanu
 
PDF
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
PDF
Prim
Ankit Dubey
 
Program in ‘C’ language to implement linear search using pointers
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-2
Dr. Loganathan R
 
One dimensional operation of Array in C- language
9096308941
 
Computer programing w
cexpertise
 
Odd number
Ankit Dubey
 
C Programming Example
PRATHAMESH DESHPANDE
 
C Programming Example
University of Potsdam
 
Insertion sort
Hitesh Kumar
 
Add digits of number in c
mohdshanu
 
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 

Similar to Bcsl 033 data and file structures lab s1-1 (20)

PPTX
Cse 121 presentation on matrix [autosaved]
Kanis Fatema Shanta
 
PDF
Data Structure & Algorithms - Matrix Multiplication
babuk110
 
PPTX
C Programming Language Part 8
Rumman Ansari
 
PPTX
Array matrix example programs - C language
Sk_Group
 
PDF
2D array
A. S. M. Shafi
 
PDF
C++ TUTORIAL 5
Farhan Ab Rahman
 
PDF
IRJET- Matrix Multiplication using Strassen’s Method
IRJET Journal
 
PDF
9.2 Matrices
smiller5
 
PDF
C programs
Adnan Vallippadan
 
PPTX
Lesson 3 - matrix multiplication
Jonathan Templin
 
PPT
matrices basic operation.ppt
Mahesh Kumar Lohano
 
PDF
7.5 Matrices and Matrix Operations
smiller5
 
DOCX
matmultHomework3.pdfNames of Files to Submit matmult..docx
andreecapon
 
PPT
CBSE Class XI Programming in C++
Pranav Ghildiyal
 
PPTX
Arrays 2d Arrays 2d Arrays 2d Arrrays 2d
LakshayBhardwaj39
 
PDF
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
PPT
Algebra unit 9.1
Mark Ryder
 
Cse 121 presentation on matrix [autosaved]
Kanis Fatema Shanta
 
Data Structure & Algorithms - Matrix Multiplication
babuk110
 
C Programming Language Part 8
Rumman Ansari
 
Array matrix example programs - C language
Sk_Group
 
2D array
A. S. M. Shafi
 
C++ TUTORIAL 5
Farhan Ab Rahman
 
IRJET- Matrix Multiplication using Strassen’s Method
IRJET Journal
 
9.2 Matrices
smiller5
 
C programs
Adnan Vallippadan
 
Lesson 3 - matrix multiplication
Jonathan Templin
 
matrices basic operation.ppt
Mahesh Kumar Lohano
 
7.5 Matrices and Matrix Operations
smiller5
 
matmultHomework3.pdfNames of Files to Submit matmult..docx
andreecapon
 
CBSE Class XI Programming in C++
Pranav Ghildiyal
 
Arrays 2d Arrays 2d Arrays 2d Arrrays 2d
LakshayBhardwaj39
 
C++ ARRAY WITH EXAMPLES
Farhan Ab Rahman
 
Algebra unit 9.1
Mark Ryder
 
Ad

More from Dr. Loganathan R (17)

PDF
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
PDF
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
PDF
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
PPT
Introduction to Information Security
Dr. Loganathan R
 
PDF
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
PDF
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
PDF
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
PDF
IGNOU Assembly Language Programming
Dr. Loganathan R
 
PDF
Requirement engineering process
Dr. Loganathan R
 
PDF
MCS 012 computer organisation and assembly language programming assignment…
Dr. Loganathan R
 
PDF
Software requirements
Dr. Loganathan R
 
PDF
Software process
Dr. Loganathan R
 
PDF
Software engineering critical systems
Dr. Loganathan R
 
PDF
Software engineering socio-technical systems
Dr. Loganathan R
 
PDF
Software engineering introduction
Dr. Loganathan R
 
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
Introduction to Information Security
Dr. Loganathan R
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
IGNOU Assembly Language Programming
Dr. Loganathan R
 
Requirement engineering process
Dr. Loganathan R
 
MCS 012 computer organisation and assembly language programming assignment…
Dr. Loganathan R
 
Software requirements
Dr. Loganathan R
 
Software process
Dr. Loganathan R
 
Software engineering critical systems
Dr. Loganathan R
 
Software engineering socio-technical systems
Dr. Loganathan R
 
Software engineering introduction
Dr. Loganathan R
 
Ad

Recently uploaded (20)

PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Dimensions of Societal Planning in Commonism
StefanMz
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 

Bcsl 033 data and file structures lab s1-1

  • 1. s1-1 Write a program in `C’ language that accepts two matrices as input and prints their product. #include <stdio.h> #include <conio.h> void main() { int a[10][10],b[10][10],c[10][10],i,j,k,m,n,p,q; clrscr(); printf("Enter the order of the first matrixn"); scanf("%d%d",&m,&n); printf("Enter the order of the second matrixn"); scanf("%d%d",&p,&q); if(n!=p) printf("The matrix can not be multipliedn"); else { printf("Enter the elements of the first matrixn"); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); printf("Enter the elements of the second matrixn"); for(i=0;i<p;i++) for(j=0;j<q;j++) scanf("%d",&b[i][j]); for(i=0;i<m;i++) for(j=0;j<q;j++) { c[i][j]=0; for(k=0;k<n;k++) c[i][j]=c[i][j]+(a[i][k]*b[k][j]); } printf("The resultant matrix of multiplication:n"); for(i=0;i<m;i++) { for(j=0;j<q;j++) printf("%dt",c[i][j]); printf("n"); } } getch(); } Page 1