I am supposed to modify this program so it begins by asking the user for the number of values. The program then uses a loop to read the specified number of values and then display their average. program is below that i worked on in class. I been working on this all day and done tired everything anybody can tell me what im missing or what i left out not sure what to do next?

dim value as integer
dim average as integer
dim total as integer
for x as integer = 1 to 5
console.write("please type a value:")
value = Console.Readline()
total = total + value
next
console.write("The average is")
average = total / 5
console.write(average)

The program has certain issues:

1. there should be a variable outside of the for loop to register the number of values, which is NOT fixed at 5.
Let's say this is stored as "num".
2. value, total and average should be decimal numbers (and not integers), because the average of 2 and 3 is 2.5.
3. The temporary variable x should preferably be declared like other variables.
4. The rest of it seems OK. Make the appropriate modifications, compile, and run as required.

DIM NUM AS INTEGER
DIM X AS INTEGER
dim value as DECIMAL
dim average as DECIMAL
dim total as DECIMAL
CONSOLE.WRITE("How many values:")
NUM = CONSOLE.READLINE()
for x = 1 to NUM
console.write("please type a value:")
value = Console.Readline()
total = total + value
next
console.write("The average is")
average = total / NUM
console.write(average)

To modify the program to ask the user for the number of values, you can use the following steps:

1. Declare a variable to store the number of values entered by the user. Let's call it `numberOfValues` and initialize it to zero.
2. Prompt the user to enter the number of values using `Console.WriteLine` or `Console.Write` followed by `Console.ReadLine()`. Store the user's input in the `numberOfValues` variable.
3. Modify the loop condition from `1 to 5` to `1 to numberOfValues` to ensure the loop runs the specified number of times.
4. Inside the loop, prompt the user to enter a value using `Console.Write` or `Console.WriteLine` followed by `Console.ReadLine()`. Store the user's input in the `value` variable.
5. Update the `total` variable by adding the `value` to it.
6. After the loop, calculate the average by dividing the `total` by the `numberOfValues` and store it in the `average` variable.
7. Finally, display the average using `Console.WriteLine` or `Console.Write` followed by the `average` variable.

Here's the modified version of your program:

```vb
Dim numberOfValues As Integer = 0
Dim value As Integer
Dim average As Integer
Dim total As Integer

Console.Write("Please enter the number of values: ")
numberOfValues = Convert.ToInt32(Console.ReadLine())

For x As Integer = 1 To numberOfValues
Console.Write("Please enter a value: ")
value = Convert.ToInt32(Console.ReadLine())
total += value
Next

Console.Write("The average is ")
average = total / numberOfValues
Console.WriteLine(average)
```

Make sure to save the changes and run the modified program to test it out.