Project 9: Question

Rumman Ansari   Software Engineer   2026-02-15 12:14:23   18  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

Write a program to declare a matrix A [ ] [ ] of order (M × N) where ‘M’ is the number of rows and ‘N’ is the number of columns such that both M and N must be greater than 2 and less than 10. Allow the user to input integers into this matrix. Display appropriate error message for an invalid input.

Perform the following tasks on the matrix:

(a) Display the input matrix
(b) Rotate the matrix by 270° anti-clockwise and display the resultant matrix
(c) Calculate the sum of the odd elements of the matrix and display

Test your program for the following data and some random data:

Example 1
INPUT:
M = 3
N = 4

ENTER ELEMENTS: 8, 7, 9, 3, -2, 0, 4, 5, 1, 3, 6, -4


Example 2
INPUT:
M = 3
N = 2

ENTER ELEMENTS: 9, 13, 41, 5, 6, -5


Example 3
INPUT:
M = 2
N = 10

OUTPUT: INVALID INPUT




Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.