Hello Sparklies and welcome to the forum,
I will put down the rough pseudocode for this algorithm and you can refine to match the exact criteria:
Initialize num_of_inputs to 0 (will hold the number of values entered by user)
Initialize sum_input_values to 0 (will hold the running total of all the values entered
Initialize value_average to 0 (will be used to hold average of the values at end of algorithm)
[BEGIN LOOP]
Get user input into current_value
sum_input_values = sum_input_values + current_value
num_of_inputs = num_of_inputs + 1
Ask user if they have more values to enter: Y/N
[END LOOP]
If Y --> go back to [BEGIN LOOP]
If N --> output average of inputted values
value_average = sum_input_values / num_of_inputs
Print to user: "Average value of " num_of_inputs " is " value_average
Hope that helps seeing my take on the pseudocode to solve this problem.
Cheers,
Tom
Hi.
I am a current college student taking Programming Logic and Technique. This class uses VisualLogic for now and eventually VBasic.net
below is the problem i am working on. I need help w/ the program to compute averages when the exact # of values being entered is unknown.
==============
Write a new program that reads a list of values from the user until the user enters the sentinel value -1. At that point the program should display the average of the values entered (not including the sentinel).
==============