Computer Science, asked by divyatasfan, 10 months ago

write a program to input 5 marks of subject and total of it make average​

Answers

Answered by sana14386
0

Answer:

Logic to find total, average and percentage

Input marks of five subjects. ...

Calculate sum of all subjects and store in total = eng + phy + chem + math + comp .

Divide sum of all subjects by total number of subject to find average i.e. average = total / 5 .

Calculate percentage using percentage = (total / 500) * 100

Answered by AskewTronics
0

Following are the program for the above question in python language:

Explanation:

total=0#variable to calculate the total marks.

for x in range(1,6): #for loop which take the marks and calculate.

   marks=int(input("Enter the "+str(x)+" subject marks of the student: ")) #take the marks as input.

   total=total+marks #calculate the marks.

print("The total marks of the subject is "+str(total)+" And the average marks of the subject is: "+str(total/5)) #print the total marka and teh average.

Output:

  • If the user inputs the marks as 1,2,3,4,5, then the output are "total=15" and the average="3".

Code Explanation:

  • The above code is in python language, which will take the value of the marks of the 5 subjects with the help of for loop.
  • The for loop holds the input function which renders the instruction for the user and takes the value of the marks and stores the value on the marks variable after converting it into an int.
  • Then print the marks and the average with the help of print function.

Learn More:

  • Python :brainly.in/question/14689905

Similar questions