Write a program to declare a matrix A
[][] of order (MXN)
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 20. Allow the user to input
integers into this matrix.
Perform the following tasks on the
matrix:
1. Display the input matrix
2. Find the maximum and minimum value
in the matrix and display
them along with their position.
3. Sort the elements of the matrix in
ascending order using any
standard sorting technique and
rearrange them in the matrix.
Output the rearranged matrix.
Sample input Output
INPUT:
M=3
N=4
Entered values:
8,7,9,3,-2,0,4,5,1,3,6,-4
Original matrix:
8 7 9 3
-2 0 4 5
1 3 6 -4
Largest Number: 9
Row: 0
Column: 2
Smallest Number: -4
Row=2
Column=3
Rearranged matrix:
-4 -2 0 1
3 3 4 5
6 7 8 9
No comments:
Post a Comment