Question: Write a program that calls two functions in the main program namely inner_product and inner_product_reverse. The first function is declared as: int inner_product(int a[], int

Write a program that calls two functions in the main program namely inner_product and inner_product_reverse.

The first function is declared as:

int inner_product(int a[], int b[],int n);

The function should return a[0]*b[0]+ a[1]*b[1]+ ... +a[n-1] *b[n-1].

The second function is declared as: int inner_product_reverse (int a[], int b[], int n);

The function should return a[0]*b[n-1]+ a[1]*b[n-2] + ... +a[n-1] *b[0].

Note: Let us assume that both arrays a and bare of size 10: a[0]-a[9] and b[0]-b[9]

Enter the first array of size 10: 10 1 4 -16 0 12 13 -17 90 0

Enter the second array of size 10: 0 0 0 -2 9 12 -3 4 0 -40

Inner product is: 69

Inner product reverse is: -254

Here is what the program should look like, just fill out where the red stars are:

Write a program that calls two functions in the main program namely

include define N 1 int inner-product (int a[], int b [], int n); int inner _product reverse (int all, int bll, int n) int main (void) int a[N],bIN], i; YOU NEED TO COMPLETE HERE.... retu rr int inner-product (int a[], int b [], int n) YOU NEED TO COMPLETE HERE... . int inner_product_ reverse (int al, int bll, int n) g YOU NEED TO COMPLETE HERE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!