I need the program to do a calculation after the user inputs 10 numbers
This is what I have tried so far Any ideas where I am going wrong:
int count;
float value, high,low, sum,average;
sum=0;
count=0;
input:
printf("Enter a number (enter negative value to finish program):\n");
scanf_s("%f",&value);
output:
average=sum/count;
if(count==10)
{
printf("total values :%d\n",count);
printf("The Highest value :%f\nLowest Value: %f\n",high,low);
printf("The average of the values is:%f\n",average);
}
I have include int i=0; and the start of the while loop but I don't understand within the while loop the coding for when the user input numbers.
Sorry but I am new to C++ programming
any other ideas
int i = 0;
while(i < 10) //Loop will run 10 times.
{
scanf(%f, &value); //Get value from user
//Do your checks for low, high etc...
++i; //Increment i
}
And then after this you put your code:
1 2 3
printf("total values :%d\n",count);
printf("The Highest value :%f\nLowest Value: %f\n",high,low);
printf("The average of the values is:%f\n",average);