Computer Science, asked by anagha238, 2 months ago

write a qbasic program to take salaries of 10 people and find the average​

Answers

Answered by anindyaadhikari13
0

Solution:

The given code is written in QBASIC.

CLS

SUM = 0

FOR I = 1 TO 10

   INPUT "Enter salary: "; A

   SUM = SUM + A

NEXT I

AV = SUM / 10

PRINT "Average salary: "; AV

END

Explanation:

  • Line 1: Clears the screen.
  • Line 2: Initialize SUM = 0 to store the sum of the salaries.
  • Line 3: Declare a loop to accept the salaries of 10 people.
  • Line 4: The salary of the employee is accepted.
  • Line 5: The salary is added to the SUM variable.
  • Line 6: End of loop.
  • Line 7: Average salary is obtained by dividing the sum by 10.
  • Line 8: The average salary is now displayed.
  • Line 9: End of loop.

Output is attached.

Attachments:
Similar questions
Math, 2 months ago