i wrote up a program using functions to calculate a sum and product. I looked it over and it looks right to me, but im not getting the desired values...
not really sure where i went wrong, thanks for the help.
#define MAX_ELEMS 100
void SumAndProduct (double, int, double, double);
int count = 0;
double val, sum, product;
printf("Enter array values (or 0.0 to stop): ");
} while( val != 0.0 && count < MAX_ELEMS);
SumAndProduct(arr, count , sum, product);
printf("The sum is %f and the product is %f. \n", sum, product);
void SumAndProduct( double a, int len, double sum, double prod)
prod = 1.0;
sum = 0.0;
for(i=0; i< len;i++)
sum = sum + a[i];
prod = prod * a[i];