Solution:
The given problem is solved in QBASIC.
CLS
INPUT "Enter first character:"; A$
INPUT "Enter second character:"; B$
INPUT "Enter third character:"; C$
SUM = ASC(A$) + ASC(B$) + ASC(C$)
PRINT "Sum:"; SUM
SUM = SUM / 3
PRINT "Average:"; SUM
END
Explanation:
- Line 1: Clears the screen.
- Line 2-4: Accepts three characters from the screen. When we want to input characters/string, we have to give a dollar ($) sign after the variable name.
- Line 5: Using ASC() function, sum of the ASCII values is calculated.
- Line 6: The Sum is then displayed on the screen.
- Line 7: The sum is divided by 3 to get the average.
- Line 8: The average of ASCII value is displayed on the screen.
- Line 9: End of program.
Refer to attachment for output.