Page 1 of 1

. (Diagonal matrix) • Assume that a sequence of n numbers is given. • Convert the sequence (1-D array) to an n x n diago

Posted: Fri May 20, 2022 12:24 pm
by answerhappygod
Diagonal Matrix Assume That A Sequence Of N Numbers Is Given Convert The Sequence 1 D Array To An N X N Diago 1
Diagonal Matrix Assume That A Sequence Of N Numbers Is Given Convert The Sequence 1 D Array To An N X N Diago 1 (39.22 KiB) Viewed 36 times
Use C PROGRAMMING to write a code that displays the diagonal
matrix
. (Diagonal matrix) • Assume that a sequence of n numbers is given. • Convert the sequence (1-D array) to an n x n diagonal matrix (2-D array) where the diagonal entries are the sequence. 1 0 0 0 1 1 -2 3 3 -2 -4 0 0 0 0 0 3 1:18 0 0 0 -4

• Program setup 1) Ask the user to enter a sequence of n = 4 elements (float), and store them in an array a. 2) Implement a function that creates a 2-D array (n x n) where the diagonal entries are the sequence a. 3) Display the diagonal matrix. The prototypes of the functions are as follows. - void diag(float a[], float diag_a[][LEN], int len); - void mat_print(float diag_a[LEN][LEN], int len);