Octal Matrix ISC Computer Science 2020 Practical
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 the value of 'M' must be greater than 0 and less than 10 and the value of 'N' must be greater than 2 and less than 6. Allow the user to input digits (0 - 7) only at each location, such that each row represents an octal number. Example: 2 3 1 (decimal equivalent of 1 st row = 153 i.e. 2 ✕ 8 2 + 3 ✕ 8 1 + 1 ✕ 8 0 ) 4 0 5 (decimal equivalent of 2 nd row = 261 i.e. 4 ✕ 8 2 + 0 ✕ 8 1 + 5 ✕ 8 0 ) 1 5 6 (decimal equivalent of 3 rd row = 110 i.e. 1 ✕ 8 2 + 5 ✕ 8 1 + 6 ✕ 8 0 ) Perform the following tasks on the matrix: (a) Display the original matrix (b) Calculate the decimal equivalent for each row and display as per the format given below. Test your program for the following data and some random data: Example 1 : INPUT: M = 1 N = 3 ENTER ELEMENTS FOR ROW 1: 1 4 4 OUTPUT: FILLED MATRIX 1 4 4 DECIMAL E...