You are on page 1of 12

A C PROGRAM TO PERFORM VARIOUS

OPERATIONS ON MATRICES

A PROJECT BY-

ADITI KUMARI - 11500220021


ABHIK CHAKRABORTY - 11500220022
ANINDYA BISWAS - 11500220023
SOUMYADIP BHATTACHARYYA - 11500220024
ACKNOWLEDGEMENT

We would like to express our special thanks of gratitude to our professor “Mr. Balaram Ghosal” sir for
his able guidance and support in completing our project.

We would also like to thank our institution for providing the opportunity to us, the students, to research
and gain deeper knowledge about the subject.
INTRODUCTION

A C Program is designed to perform matrix addition, subtraction,


multiplication, and transpose. We have developed appropriate C functions
for the following to perform matrix addition, subtraction, multiplication, and
transpose operations.
WHAT ARE MATRICES?

In mathematics, a matrix is a rectangular array or table of numbers, symbols, or expressions,


arranged in rows and columns. Provided that they have the same dimensions two matrices can be
added or subtracted element by element .The rule for matrix multiplication, however, is that two
matrices can be multiplied only when the number of columns in the first equals the number of rows
in the second .
Start FLOWCHART FOR MATRIX ADDITION

Declare A[r][c] B[r][c]


and C[r][c]

Read r ,c, p, A[]


[] and B[][]

i=0, j=0

yes yes
i<r J<c C[i][j]=A[i][j]+B[i][j]

no no

Print C i=i+1 J=j+1

End
Start FLOWCHART FOR MATRIX SUBTRACTION

Declare A[r][c] B[r][c]


and C[r][c]

Read r ,c, p, A[]


[] and B[][]

i=0, j=0

yes yes
i<r J<c C[i][j]=A[i][j]-B[i][j]

no no

Print C i=i+1 J=j+1

End
Start
FLOWCHART FOR MATRIX MULTIPLICATION (part-A)
Read m,n,p,q
no

no yes yes
If(n!=p) for i = 0 to m for j = 0 to n Read a(i)(j)

y
e n
s o
Matrix can’t
multiply
yes yes
for i = 0 to p for i = 0 to q Read b(i)(j)

no

A
Stop
FLOWCHART FOR MATRIX MULTIPLICATION (part-B)

no

yes yes
A for i = 0 to m for j = 0 to q C[i][j]=0

C[i][j]=c[i][j]+a[i] yes
[k]*b[k][j] for i = 0 to n

n no
o
yes yes Print c[i][j]
for i = 0 to m for i = 0 to q

Stopn
o
Start
FLOWCHART FOR TRANSPOSE OF A MATRIX

Declare A[m][n] B[m][n]

Read matrix
a[m][n]

Declare variables i, j

i=0, j=0

yes yes b[i][j] =a[j][i]


i<n J<m
i=j+1
no no
Print
i=i+1
matrix b

End
ADVANTAGES OF USING C TO PERFORM MATRIX
OPERATIONS

. TIME SAVING
. EASY TO USE
. CALCULATES AND GIVE PERFECT ANSWERS IN NO TIME
. HIGHER RATE OF ACCURACY
REFERENCES

 https://www.knowprogram.com/c-programming/

 https://www.geeksforgeeks.org/

 https://www.Wikipedia.org/
THANK YOU!!

You might also like