write a program to accept three characters and print the sum of their ASCII values and also print their average (QBASIC)
Answers
Answered by
1
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.
Attachments:
anindyaadhikari13:
Thanks for the brainliest ^_^
Answered by
0
Answer:
what is the meaning of although I am in the correct answer of what is the correct answer of although I am not able to kya hai yrr is the correct answer of what you have a good morning or aap sab kaise hain kya hua tha isliye se bhi bolo na hai kya
Similar questions
Social Sciences,
9 days ago
Accountancy,
9 days ago
Chemistry,
9 days ago
Math,
19 days ago
English,
19 days ago
English,
9 months ago