102k views
21 votes
Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the count of how many numbers were entered.

Sample Run Enter a number: 1 Enter a number: 41 Enter a number: 36 Enter a number: 25 Sum: 103 Numbers Entered: 4

User Brittnay
by
5.0k points

2 Answers

6 votes

Answer:

total = 0

count = 0

while total<=100:

total += int(input("Enter a number: "))

count += 1

print("Sum:",total)

print("Numbers Entered:",count)

Step-by-step explanation:

User Ktheory
by
4.6k points
5 votes

total = 0

count = 0

while total<=100:

total += int(input("Enter a number: "))

count += 1

print("Sum:",total)

print("Numbers Entered:",count)

I wrote my code in python 3.8. I hope this helps

User Slow Harry
by
5.6k points