In this exercise you will create a program that computes the average of a collection

of values entered by the user. The user will enter 0 as a sentinel value to indicate
that no further values will be provided. Your program should display an appropriate
error message if the first value entered by the user is 0.

sum=0

count=0
loop {
print " enter value"
read value
if value=0 then exit loop
sum += value
count += 1
}
if count=0 then print "no values entered"
else {
avg = sum/count
print "the average of ", count, " values is ", avg
}

Why did the programmer go broke?

Because he forgot to put the "0" as a sentinel value!

To create a program that computes the average of a collection of values entered by the user, follow these steps:

1. Initialize the sum and count variables to zero.
2. Prompt the user to enter the first value.
3. Read the user's input and store it in a variable.
4. Check if the value entered by the user is zero. If it is, display an appropriate error message and exit the program.
5. Add the value to the sum and increment the count by 1.
6. Prompt the user to enter the next value.
7. Repeat steps 3 to 6 until the user enters zero.
8. Calculate the average by dividing the sum by the count.
9. Display the average to the user.

Here's a sample implementation in Python:

```python
# Step 1
sum = 0
count = 0

# Step 2
print("Enter values to compute the average. Enter 0 to stop.")

# Step 3
value = float(input("Enter a value: "))

# Step 4
if value == 0:
print("Error: First value cannot be zero.")
exit()

# Step 5
sum += value
count += 1

# Step 6
value = float(input("Enter another value (or 0 to stop): "))

# Step 7
while value != 0:
sum += value
count +=1
value = float(input("Enter another value (or 0 to stop): "))

# Step 8
average = sum / count

# Step 9
print("The average is:", average)
```

Note: You can replace the `print()` function calls with appropriate dialog boxes if you are running the program in a graphical environment.

To create a program that computes the average of a collection of values entered by the user, you can follow these steps:

1. Initialize a variable to keep track of the sum and another variable to count the number of values entered.
2. Prompt the user to enter a value.
3. Use a loop to continuously prompt the user for values until they enter 0 as the sentinel value.
4. Inside the loop, check if the first value entered is 0. If it is, display an error message and exit the program.
5. If the value is not 0, add it to the sum and increment the count variable.
6. After the loop ends (because the user entered 0), calculate the average by dividing the sum by the count.
7. Display the average to the user.

Here is an example implementation in Python:

```python
# Step 1
sum = 0
count = 0

# Step 2
value = float(input("Enter a value (0 to stop): "))

# Step 3
while value != 0:
# Step 4
if count == 0 and value == 0:
print("Error: The first value cannot be 0")
exit()

# Step 5
sum += value
count += 1

# Step 3 (continuation)
value = float(input("Enter a value (0 to stop): "))

# Step 6
average = sum / count

# Step 7
print("Average:", average)
```

With this program, the user will be prompted to enter values until they enter 0. The program will validate if the first value is 0, and display an error message if it is. Otherwise, it will compute the average of the entered values and display the result.