Computer Science, asked by flyingarupa2723, 3 days ago

Write a QBASIC program to read the value of marks in any five different subject.Find the total percentage of a students.

Answers

Answered by anindyaadhikari13
3

Solution:

The given problem is solved in QBASIC.

CLS

INPUT "Enter marks in first subject: "; A

INPUT "Enter marks in first subject: "; B

INPUT "Enter marks in first subject: "; C

INPUT "Enter marks in first subject: "; D

INPUT "Enter marks in first subject: "; E

TOTAL = A + B + C + D + E

PERC = TOTAL / 5

PRINT "You obtained:"; TOTAL

PRINT "Percentage:"; PERC

END

Explanation:

  • Line 1: Clears the screen. CLS command is used to clear the screen.
  • Line 2-6: Accepts the marks in 5 subjects.
  • Line 7: Calculates the total marks by adding up the marks entered.
  • Line 8: Calculates the percentage of marks by dividing the total by 5.
  • Line 9-10: Total marks and the percentage is displayed.
  • Line 11: End of program.

Refer to the attachment for output.

Attachments:
Similar questions