Q basic WAP to store marks of four subject Now
calculate and display total marks and
average marks.
Answers
Answered by
1
The given code is written in QBASIC.
CLS
INPUT "Enter marks of first subject: "; A
INPUT "Enter marks of second subject: "; B
INPUT "Enter marks of third subject: "; C
INPUT "Enter marks of second subject: "; D
TOTAL = A + B + C + D
AVG = TOTAL / 4
PRINT "Total Marks Obtained: "; TOTAL
PRINT "Average Marks Obtained: "; AVG
END
- Line 1: Clears the screen.
- Line 2-5: Accept the marks of four subjects.
- Line 6: Add the marks and store the result in variable 'TOTAL'.
- Line 7: Divide the total marks by 4 and store the result in variable 'AVG'.
- Line 8: Print the total marks obtained.
- Line 9: Print the average marks obtained.
- Line 10: End of program.
See the attachment for output.
Attachments:
Similar questions