Problem Solving and Programming(3)
Problem Solving and Programming(3)
PROGRAMMING
Krishna Ramanbainwad
ET-E BATCH-2 ROLL NO. 36
PRN:12410651
Assignment-7:
Write a menu-driven C program to
perform the following operations on
2D arrays (matrices):
Operations:
1. Addition of two matrices
2. Multiplication of two matrices
3. Transpose of a matrix
Soln :
Algorithim:-
Step 1: Start
Step 2: Display the menu with 3 options:
1. Addition of two matrices
2. Multiplication of two matrices
3. Transpose of a matrix
Step 3: Read user’s choice
Step 4: Based on the choice:
Case 1:
a. Input dimensions (rows and
columns)
b. Input two matrices
c. Add the matrices
d. Display the result
Case 2:
a. Input dimensions of two
matrices
b. Input the matrices
c. If column of 1st ≠ row of 2nd,
print error
d. Else multiply matrices
e. Display result
Case 3:
a. Input dimensions of the matrix
b. Input the matrix
c. Transpose the matrix
d. Display result
Default:
a. Print "Invalid choice"
Step 5: End
Code:-
Output:-