Input, Let and print statements.
b) Write a program to find the sum of any five numbers using LET and PRINT
statements.
Answers
Answered by
5
Solution.
The given code is written in QBASIC.
CLS
LET A = 10
LET B = 20
LET C = 30
LET D = 40
LET E = 50
LET SUM = A + B + C + D + E
PRINT "The sum of the numbers is:"; SUM
END
Explanation.
- Line 1: Clears the screen.
- Line 2-6: Here, I have declared 5 numbers using let statement.
- Line 7: Here, the sum of 5 numbers is calculated.
- Line 8: The sum of the numbers is displayed.
- Line 9: End of program.
See attachment for output.
Attachments:
Similar questions
English,
1 month ago
Social Sciences,
1 month ago
English,
1 month ago
World Languages,
2 months ago
English,
2 months ago
Math,
10 months ago
Math,
10 months ago