I just wrote the following program which asks the user for an input of how many numbers they'd like to enter in, adds them up, gets the average and displays the highest and lowest.

Now the book is asking me to modify the program such that is will display the range of values. What does that mean? Go easy, I've been out of school a long time. Here is the other program, which is fine, as a reference.

Code:

#include <stdio.h>
int main (void)
{
int loop_count, lowest_num, highest_num, loop, initial, number, sum, actual_sum;
double average;
sum = 0;
printf ("Please enter the amount of numbers you would like to use>> ");
scanf ("%d", &loop_count);
while (loop_count < 2)
{
printf ("This program requires at least 2 inputs.\nPlease try again>> ");
scanf ("%d", &loop_count);
}
printf ("Please enter the first number>> ");
scanf ("%d", &initial);
lowest_num = initial;
highest_num = initial;
for (loop = 1; loop < loop_count; loop = loop +1)
{
printf ("Please enter the next number>> ");
scanf ("%d", &number);
if (number < lowest_num)
{
lowest_num = number;
}
else if (number > highest_num)
{
highest_num = number;
}
else
{
number = number;
}
sum = sum + number;
}
printf ("\nThe lowest number in the set is: %d\n\n", lowest_num);
printf ("The highest number in the set is: %d\n\n", highest_num);
actual_sum = sum + initial;
printf ("The sum of the numbers is: %d\n\n", actual_sum);
average = (double)actual_sum / (double)loop_count;
printf ("The average of the numbers is: %.2lf\n\n", average);
return 0;
}