WAP that accepts marks in 5 subjects and output average marks
Answers
Answered by
6
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().
Attachments:
Answered by
3
Answer:
s,avg=0,0
print("Enter 5 subject marks")
for I in range(1,5+1):
M=(int)(input())
s+=M
avg=s/5
print("Average:",avg)
•Output Attached.
••••
Attachments:
Similar questions