Computer Science, asked by Misukiie, 19 days ago

write a program to accept three characters and print the sum of their ASCII values and also print their average (QBASIC)​

Answers

Answered by anindyaadhikari13
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:

  1. Line 1: Clears the screen.
  2. 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.
  3. Line 5: Using ASC() function, sum of the ASCII values is calculated.
  4. Line 6: The Sum is then displayed on the screen.
  5. Line 7: The sum is divided by 3 to get the average.
  6. Line 8: The average of ASCII value is displayed on the screen.
  7. Line 9: End of program.

Refer to attachment for output.

Attachments:

anindyaadhikari13: Thanks for the brainliest ^_^
Answered by hanktam45
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