Need help with array calculation
Hello everyone,
I am trying do a simple calculation using (2) arrays a for loop and a counter however I am not receiving the print results that I am looking for.
My intent is to take a prepopulated array with figure amounts and multiple them times an interest rate. display that amount then store this amount in another array.
I wanted to use a for loop since I have all ready demensioned the array. While populating the temp array I want to total the sum of all of the items processed.
Could someone look at my code and maybe point me in the right direction?
Code:
#include <stdio.h>
main()
{
//Set store tax variables
float StoreTax1 = 7.25;
//Declare ProductPrice array
float ProductPrice[10]={4.25, 3.00, 1.25, 5.50, 2.50, 7.00, 8.00, 9.00, 8.50, 11.00};
float Store1TaxPerItem[10];
float Store1;
int x = 0;
printf("Begin process");
for (x = 0; x < 9; x++ )
Store1TaxPerItem[x] = ProductPrice[x] * (StoreTax1/100);
printf("The result Store1TaxPerItem %f\n", Store1TaxPerItem[x]);
Store1 = Store1 + Store1TaxPerItem[x];
printf("The result is %f\n", Store1);
}