35.8k views
3 votes
Write an algorithm to determine a students final grade and indicate whether it is passing or failing .the final grade is calculated as average of 4 exams

grade>60 pass else fail​

1 Answer

4 votes

Answer:

total = 0

for i 1 to 4:

input grade

total += grade

end

average = total / 4

if average is greater than 60:

print("Passing")

else:

print("Failing")

Step-by-step explanation:

The above algorithm (pseudocode) is written considering Python language.

Initialize the total as 0

Create a for loop that iterates four times. For each iteration, get a grade froum the user and add it to the total.

When the loop is done, calculate the average, divide total by 4.

Check the average. If it is greater than 60, print "Passing", otherwise print "Failing".

User Bibhu
by
6.6k points