0% found this document useful (0 votes)
6 views

10-AddMultMatrix-Functions

Addition Of math

Uploaded by

lovely143yt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

10-AddMultMatrix-Functions

Addition Of math

Uploaded by

lovely143yt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Main

implement Matrix Addition &


Multiplication

Integer m, n, p, q, ch

Output "implementation of
Matrix Addition &
Multiplication"

Output
"
1. Addition of 2 Matrices
( Condition is :: R1=R2 &
C1=C2
).
2. Multiplication of 2
Matrices ( Condition is
:: R1=C2 & C1=R2
).
Enter Ur Choice
::
"

Input ch

Output "Enter RowSize &


Column Size of Matrix-A"

Input m

Input n

Output "Enter RowSize &


Column Size of Matrix-B"

Input p

Input q

False True
ch = 1

False True
ch != 2 False True
m=p and n=q

False True Output


m=q or n=p "
Wrong i/p Output "Addition not addMat( m,n )
!!! possible! ThankYou, Good
Byeeee...!"
Output "Multiplication not multMat(m,n,q) GoodByeeee....
Output "Thank You!"
possible! ThankYou, Good "
Byeeee...!"

Output "Thank You!"

End
addMat
(Integer m, Integer n)

Integer Array A[m*n], B[m*


n], C[m*n]

Integer i

Output "Enter Elements for


Matrix-A"

Next
i = 0 to m*n - 1

Done
Output "Enter a no."

Input A [ i ]

Output "Enter Elements for


Matrix-B"

Next
i = 0 to m*n - 1

Done
Output "Enter a no."

Input B [ i ]

Next
i = 0 to m*n - 1

Done
Input B [ i ]

Output "[A] + [B] in " & m & " *


" & n & " ORDER is "

Next
i = 0 to m*n - 1

Done
Output A[i] + B[i]

End
multMat
(Integer m, Integer n, Integer q)

Integer Array A[m*n]

Integer Array B[n*q]

Integer Array C[m*q]

Integer i, j, k

Output "Enter Elements for


Matrix-A"

Next
i = 0 to m*n - 1

Done
Output "Enter a no."

Input A [ i ]

Output "Enter Elements for


Matrix-B"

Next
i = 0 to n*q - 1

Done
Output "Enter a no."

Input B [ i ]

Next
i = 0 to m-1

Done
Next
j = 0 to q-1

Done
C [ i*q + j ] = 0

Next
k = 0 to n-1

Done
C [ i*q + j ] = C [ i*q + j ] + A
[ i*n + k ] * B [ k*q + j ]

Output "[A] * [B] in " & m & " * " &


q & " ORDER is "

Next
i = 0 to m*q - 1

Done
Output C [ i ]

End

You might also like