RHUM Horimi University humaladjanola Affordable Education Ex. 6 [20 pts) Write Main 2-D An upper triangular matrix has a
Posted: Mon May 02, 2022 12:04 pm
RHUM Horimi University humaladjanola Affordable Education Ex. 6 [20 pts) Write Main 2-D An upper triangular matrix has all the elements below the main diagonal stedes Also, the matrix which has elements above the main diagonal as zero is called a lower triangular matrix. Figure 6.1 shows an Upper Triangular Matrix (U) and a Lower Triangular Matrix (L). 24h Tin VIP M tim (4) 0 Lower Titanga Figures per and Lower Triangular Matrices Develop a program that contains the following functions: • 15 pts) Function to checks whether a matrix is upper triangular, lower triangular or none. The function should receive a square array of size "n", the value of "n". It should return 1 if the array is upper triangular, -1 if it is lower triangular and o if it is none. • 15 pts) Function to output the array with each row on a line and the elements of the row separated by "The function should receive a square array of size "n", the value of "n". • 15 pts] Function to return the number of non-zero elements in both diagonals of the array. The function should receive a square array of size "n", the value of "n • [5 pts) Main to test your program on an array of n elements (n is given by user and should be less than 100) and give an output that will use each function written • [10 pts Bonus Function to replace all occurrences of numbers in the array which are larger than the average of the numbers in both diagonals with random numbers less than the average