Write a C function that, given a square matrix of floats, finds the diagonal with maximum average value. The function should have the following prototype: float matrMaxDiag(float M[DIM][DIM], int n);...

This is not a graded question so please don't disregard it as if it is. Thank you in advance professor! Ps: everything should be coded in C Not C++Write a C function that, given a square matrix of floats, finds the diagonal with maximum average<br>value. The function should have the following prototype:<br>float matrMaxDiag(float M[DIM][DIM], int n);<br>where DIM is the size of the matrix, and n (n <= DIM) is the number of rows and columns that are<br>actually used.<br>The function calculates the average value of each diagonal, and then returns the maximum of<br>such values.<br>Example of execution:<br>1.0<br>2.0<br>3.0<br>4.0<br>5.0<br>1.0<br>2.0<br>3.0<br>4.0<br>5.0<br>2.0<br>2.0<br>2.0<br>2.0<br>-2.0<br>2.0<br>2.0<br>2.0<br>2.0<br>-2.0<br>5.0/1 = 5.0<br>1.1<br>2.2<br>3.3<br>-4.4<br>5.5<br>1.1<br>2.2<br>3.3<br>-4.4<br>5.5<br>2.0/2 = 1.0<br>2.2<br>2.2<br>-3.2<br>4.2<br>4.2<br>2.2<br>2.2<br>-3.2<br>4.2<br>4.2<br>10.5/3 = 3.5<br>1.8<br>-2.3<br>3.1<br>4.9<br>5.0<br>1.8<br>-2.3<br>3.1<br>4.9<br>5.0<br>3.8/4 = 0.95<br>15.5/5 = 3.1<br>1.8/1 = 1.8 -0.1/2 = 6.4/3 =<br>-0.05<br>Max diag average: 5.0<br>5.9/4 = 1.475<br>2.133<br>|으 |으 | |~ | 00<br>

Extracted text: Write a C function that, given a square matrix of floats, finds the diagonal with maximum average value. The function should have the following prototype: float matrMaxDiag(float M[DIM][DIM], int n); where DIM is the size of the matrix, and n (n <= dim)="" is="" the="" number="" of="" rows="" and="" columns="" that="" are="" actually="" used.="" the="" function="" calculates="" the="" average="" value="" of="" each="" diagonal,="" and="" then="" returns="" the="" maximum="" of="" such="" values.="" example="" of="" execution:="" 1.0="" 2.0="" 3.0="" 4.0="" 5.0="" 1.0="" 2.0="" 3.0="" 4.0="" 5.0="" 2.0="" 2.0="" 2.0="" 2.0="" -2.0="" 2.0="" 2.0="" 2.0="" 2.0="" -2.0="" 5.0/1="5.0" 1.1="" 2.2="" 3.3="" -4.4="" 5.5="" 1.1="" 2.2="" 3.3="" -4.4="" 5.5="" 2.0/2="1.0" 2.2="" 2.2="" -3.2="" 4.2="" 4.2="" 2.2="" 2.2="" -3.2="" 4.2="" 4.2="" 10.5/3="3.5" 1.8="" -2.3="" 3.1="" 4.9="" 5.0="" 1.8="" -2.3="" 3.1="" 4.9="" 5.0="" 3.8/4="0.95" 15.5/5="3.1" 1.8/1="1.8" -0.1/2="6.4/3" =="" -0.05="" max="" diag="" average:="" 5.0="" 5.9/4="1.475" 2.133="" |으="" |으="" |="" |~="" |="">

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here