2DARRAY PROBLEMS ?
1.

ANSWER...

2. Write a program to read an N * M matrix values and print the row which rowsum is the greatest among other rows.
INPUT N = 4
M = 5
THE MATRIX VALUES ARE
4 16 12 7 24
2 8 14 5 19
1 3 6 8 55
7 10 5 15 34

OUTPUT :
THE GREATEST ROW SUM – ROW VALUES ARE

3RD ROW 1 3 6 8 55 = 73

2) INPUT N = 0
M = 0
OUTPUT :
INVALID MATRIX SIZE.

ANSWER...

3. Write a program to read two different arrays name A & B and find out the two array is anagram of each other.

ANSWER...

4. write a program to create an N x N square matrix and fill the first NxN natural numbers in circular form.

example
n=5

output
01 02 03 04 05
16 17 18 19 06
15 25 25 20 07
14 23 22 21 08
13 12 11 10 09





ANSWER...

5. write a program to read a matrix of NxM size and print its column values from last to first.



ANSWER...

6. write a program to read an n x m matrix and print the saddle point value of matrix. The saddle point value is a value which is smaller in its row, greater in its column.

example 3 x 4 matrix
1 2 3 4
5 6 8 9
4 5 3 2

the saddle point is 5






ANSWER...

7. write a program to read an n x m matrix and print particular row elements of matrix.

ANSWER...

8. write a program to read an n x m matrix and find the sum of particular row of matrix.

ANSWER...

9. Write a program to read an n x m matrix and print all values in matrix format

ANSWER...

10. write a program to read an n x m matrix and print its transpose matrix.

example 3 x 4 matrix
1 2 3 4
5 6 1 3
4 5 3 2

the transpose is
1 5 4
2 6 5
3 1 3
4 3 2


ANSWER...

11. Write a program to read a NxM matrix and print the greatest sum submatrix.

ANSWER...

12. Write a program to read an N * M matrix values and rearrange the columns as per its column sum

ANSWER...

13. Write a program to read an N * M matrix values and rearrange the rows as per its row sum

example 4 x 3 matrix

4 2 8
1 5 2
3 5 2
2 6 9

the resultant matrix

1 5 2
3 5 2
4 2 8
2 6 9

ANSWER...

14. write a program to read an n x m matrix and print particular column elements of matrix.

ANSWER...

15.

ANSWER...

16. write a program to read a matrix of nxm size and find, print the frequency of each value of matrix.

ANSWER...

17. write a program to read an n x m matrix and store first nxm natural numbers in the matrix.

for example 3 x 4 size matrix, first 12 natural numbers

1 2 3 4
5 6 7 8
9 10 11 12








ANSWER...

18. Write a program to read the size(n) of square matrix and fill the matrix with first n2 natural numbers and rotate the matrix in any one of the degrees namely 45°, 90°, 180°, 270°. The choice must be thrown to user to select the rotation degrees. The output must be as per the choice selected by user.
EXAMPLE 1:
INPUT :
SIZE :3
1 2 3
4 5 6
7 8 9
Select an option
1. Rotate 90 deg.
2. Rotate 180 deg.
3. Rotate 270 deg
Enter your choice : 1
OUTPUT :
7 4 1
8 5 2
9 6 3
EXAMPLE 2
INPUT :
SIZE : 3
1 2 3
4 5 6
7 8 9
Select an option
1. Rotate 90 deg.
2. Rotate 180 deg.
3. Rotate 270 deg
Enter your choice :3
OUTPUT :
3 6 9
2 5 8
1 4 7

ANSWER...

19. write a program to read an n x m matrix and find the product of upper diagonal elements of matrix.

ANSWER...

20. Write a program to read two matrices A & B and find its sum of A and B.

ANSWER...

21. Write a program to read a binary matrix of size n x m and find the matrix is a map or not. A matrix is said to be a map when 1’s are present and leads continuously from starting index (0,0) to ending index (n-1,m-1) either row or column direction. Lead means 1in are present in adjacent cells in a row or column.

ANSWER...

22. write a program to read a matrix of NxM size and print its row values from last to first.



ANSWER...

23. Write a program to read two matrices and find out both the matrices are equal or not.

ANSWER...

24. write a program to read a matrix of nxm size and find the mirror image of the matrix by reversing each row
Display both the original and mirrored matrix.

ANSWER...

25. write a program to read the size of a matrix and generate the magic square matrix.

ANSWER...

26. write a program to read an n x m matrix and find the sum of all values of a matrix.

ANSWER...

27. Write a program to read an NxM matrix and find out the number of sub square matrices(size should be above 1) in it. And also print each one of that.

INPUT : 1 2 4 6
7 3 2 8
8 1 5 4
OUTPUT
1 2 2 4 4 6 7 3
7 3 3 2 2 8 8 1 . . . and so on

ANSWER...

28. Write a program to read an N * M matrix values and find out the matrix is symmetic matrix or not. [ A matrix is said to be symmetric matrix when matrix and its transpose are equal. ]



ANSWER...

29. write a program to read N number of words and store it in matrix form like each word in a row. Allow the user to enter a word and check whether it appears horizontally or vertically in the matrix



ANSWER...

30. Write a program to read month and year as input and print its monthly calendar.

example
month = 10
year - 2025

the Monthly Calendar of October-2025

SUN MON TUE WED THU FRI SAT
- - - 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

ANSWER...

31. write a program to read a matrix of nxn size and check the matrix is magic square matrix or not.

The matrix is said to be a magic square when sum of rows, columns, and diagonals are equal.

example n=3

2 7 6
9 5 1
4 3 8

when sum of rows, columns and diagonals yields same value, that is 15.

ANSWER...

32. write a program to read an n x m matrix and find the greatest, smallest value of matrix.

ANSWER...

33. write a program to read a square matrix of nxn size and check the matrix is identity matrix or not.

[The matrix is said to be identity matrix, when only the diagonal elements are 1, and all other elements are 0.]

ANSWER...

34. write a program to read a matrix of NxM size and print its all possible sub matrices The submatrix row and column may be of any size but must be more than 1.




ANSWER...

35. write an program to read an n x m matrix and count the +ve and -ve values present in the matrix.

ANSWER...

36. Write a program to read two matrices A & B and find its product of A and B.

ANSWER...

37. write a program to read an N number of single dimensional array values of varying size and combine all of them into a matrix.
ex.
4 arrays
First array values - 3
1
4
5
Second array values - 2
2
6
Third array - 5
7
3
5
8
1
Fourth array - 6
9
8
5
3
4
1

The resultant Matrix is
1 4 5
2 6
7 3 5 8 1
9 8 5 3 4 1






ANSWER...

38. Write a program to read a matrix and print its upper diagonal, lower diagonal, diagonal, and right diagonal elements separately in matrix form.

ANSWER...

Hungry Minds


HUNGRY MINDS
REG.NO. 09AKEPV9632M2Z9
Regd. Office : 120, Khirighat, Basti - 272002,
Uttar Pradesh , India.

Branch Office : No 91, Vallalar Nagar, V.M. Chatiram,
Tirunelveli - 627011, India

Our Services

School Software

Payment Gateway

Church Management Software

Mobile Apps

Ecommerce Site Development

Robotics Classes



hungryminds.basti@gmail.com

vasantharaj1972@gmail.com

- 2024 Copyright is Reserved. Hungry Minds 11817, India - 7985872766.