Use fscanf() to read the data from HW4Problem2.txt into a matrix called B. Note that you need to use fgets() to avoid the header row. Make a note of B’s dimensions. Next, do the following

a) Print the matrix B with each element in the same position as it was in the text file, but with integer format for the 1st and 3rd column, fix-point format with a precision of 2 for the 2nd column, and exponential format with a precision of 5 for the last column. Put two tabs (t) between each column.

b) Multiply each element of the first column in HW4Problem2.txt by each element of the 3rd column of HW4Problem2.txt and store the result in a column vector (5×1) called c. WARNING: you better compare what you stored in B and what is in HW4Problem2.txt.

c) Do array multiplication with the values in B (4×5) times c, and store the result in a 4×1 vector called d.

d) Create a 4×2 array called M. The first column of M is the index of each row of d and the second column of M is the

corresponding value of d.

e) Use one fprintf() call to output 4 lines, each with the following form:

“The value of d at the i index of d is x.xxxxxxE+yy.”

where i ranges from 1 to 4 and represents the value of the index for the value of d that is being printed.

“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”