Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write this codes in c language (15 points) Write a function dot product that gets two one-dim arrays and finds their dot product which is
Write this codes in c language
(15 points) Write a function dot product that gets two one-dim arrays and finds their dot product which is calculated by using following formula: A[U]*C[i] where A and C are the one dim arrays. (5 points) Write a function disp_one that displays the elements of a one-dimensional array. (5 points) Write a function disp_two that displays the elements of a two-dimensional array with 4 columns (5 points read from file) Write a program that reads a 4x4 matrix and a 4 element array from a text file, and finds their product as demonstrated in the following example: * 5 11 9 16 2 4 3 1 9 12 8 7 6 1 4 10 3 6 12 4 5+3 + 11*6 + 9+12 + 16*4 2+3 + 4*6 + 3+12 + 1*4 9+3 + 12*6 + 8+12 + 7+4 6+3 + 1*6 + 4+12 + 10+4 Notice that each row of the result matrix is the dot product of one row of the matrix with the vector. Thus, you need to copy each row of the matrix to a one dim-array before using the dot_product function. The output should be displayed as in the example run, using the functions disp_one and disp_two. (See the example run below) Example Run: I. Matrix is: 5 11 9 16 2 4 3 1 9 12 8 7 6 1 4 10 III. The product is: 253 70 223 112 II. Vector is: 3 6 12 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started