1.

WAP that accepts marks in 5 subjects and output average marks​

Answer»

The following PROGRAMME is WRITTEN in python.

Program

marks1 = int(input("Enter the marks in first sub. here:\n"))

marks2 = int(input("Enter the marks in second sub. here:\n"))

marks3 = int(input("Enter the marks in third sub. here:\n"))

marks4 = int(input("Enter the marks in fourth  sub. here:\n"))

marks5 = int(input("Enter the marks in fifth sub. here:\n"))

average = (marks1+marks2+marks3+marks4+marks5)/5

print("The average is", str(average)+".")

Explanation

  • Take input using input() and CONVERT it into int datatype(TYPECASTING).
  • Write the formula of average and assign it a variable.
  • Print the said variable using print().


Discussion

No Comment Found