Q:

Write python program that calculates the sum of 5 numbers. Then draw a flowchart for it

0

Write a program that calculates the sum of 5 numbers. Then draw a flowchart for it

-----------------------------------

Example of final output:

Welcome, this program calculates the sum of Five numbers.

Enter The number: 21

Enter The number: 96

Enter The number: 57

Enter The number: 12

Enter The number: 8

The sum of the five numbers is: 194

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

num1=int(input("enter you num1"))
num2=int(input("enter you num2"))
num3=int(input("enter you num3"))
num4=int(input("enter you num4"))
num5=int(input("enter you num5"))
sum=num1+num2+num3+num4+num5
print("sum is: ",sum)

need an explanation for this answer? contact us directly to get an explanation for this answer
need an explanation for this answer? contact us directly to get an explanation for this answer

solution using while loop:

print("Welcome, this program calculates the sum of Five numbers.")
n=0
counter=1
while counter<=5:
    n=n+int(input("enter the number"))
    counter=counter+1
print("The sum of the five numbers is: ",n)

need an explanation for this answer? contact us directly to get an explanation for this answer
need an explanation for this answer? contact us directly to get an explanation for this answer

print("Welcome, this program calculates the sum of Five numbers.")
n=int(input("enter number"))
n=n+int(input("enter number"))
n=n+int(input("enter number"))
n=n+int(input("enter number"))
n=n+int(input("enter number"))
print(n)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (3)

Similar questions


need a help?


find thousands of online teachers now