Average of 3 Numbers

Purpose : QBasic TAFE Assessment

Programs : QBasic

Scripts: QBasic


A simple program that allows a user to input 3 numbers and it will calculate and display the average of the 3 numbers given.

The Code:

[cc lang=”vb”]
‘*****************************
‘ Made by Ian Blott 16/2/2005

‘*****************************

‘Clear the screan
CLS

‘Prompt the user to enter there chosen numbers
PRINT “Please enter the numbers you would like to get the average of:”

‘This is the First inputed number
INPUT a

‘This is the Second inputed number
INPUT b

‘This is the Third input number
INPUT c

‘ The threee input figures are added together
x = a + b + c

‘the result of the three figure are divided by 3 to get the average
y = x / 3

‘This will display the result / average of the three numbers.
PRINT “the average of “; a; b; c; ” = “; y; “”

[/cc]