Here is what I have so far.
Code:
#include <stdio.h>
#define N 10
int inner_product(int a[], int b[], int n);
int inner_product_reverse(int a[], int b[], int n);
int main (void)
{
int a[N], b[N], i;
printf("Enter the first array of size 10: ")
for(i=0; i<N; i++)
scanf("%d", &a[i]);
printf("Enter the second array of size 10: ")
for(i=0; i<N; i++)
scanf("%d", &b[i]);
printf("Inner product is: %d\n", inner_product(a, b, i));
printf("Inner product reverse is: %d\n", inner_product_reverse(a,b, i));
return 0;
}
int inner_product(int a[], int b[], int n)
{
int sum = 0, i;
for (i = 0; i<N; i++)
sum += (a[i] * b[i]);
return sum;
{
int inner_product_reverse(int a[], int b[], int n)
{
int sum = 0, i;
for (i = 0; i<N; i++)
sum += (a[i] * b[N-i]-i);
return sum;
}