Computer Science, asked by vannessatorres119955, 1 year ago

4.2 Code Practice: Question 2 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

Answers

Answered by luzincourt134
21

Answer:

u=float(input("Enter a number"))

c = 1

while (u <= 100):

 n = float(input("Enter a number"))

 u = u + n

 c = c + 1

print ("Sum: " + str (u))

if(u > 100):

 print ("Numbers Entered: " + str(c))

Answered by mayorierozon
7

Answer:

c = 0

sum = 0

while(sum < 101):

   n = int(input("Enter a number,100 to stop:"))

   print ("Enter a number: " + str(n))

   sum = sum + n

   c = c + 1

   

print ("Sum: " + str(sum))

print("Numbers entered: " + str(c))

Explanation:

Sum tiene que ser menor que 101 porque la suma de los números tiene que ser mayor que 100 no mayor o igual.

Similar questions