Hello!

So far I've done what I've wanted: input ten numbers in an array, calculated the average (of said numbers), and printed them. But now I'd like to print out the values in the array that are below the average (e.g. if the average is 5.5, it'd print out 1, 2, 3, 4, 5). This is as far as I can get:

Declare Real x
Declare Real sum

Set sum = 0
Declare Real avg
Declare Real num[10]

For x = 0 To 9
    Display "Enter number ", x ":"
    Input num[x]
    Set sum = sum + num[x]
    Set avg = sum / 10
End For
Display "Average: ", avg

If num[x] < avg Then
    Display num[x]
End If

How would I display values less than the average?

Thanks in advance!

Put a for loop around

If num[x] < avg Then
    Display num[x]
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.