140k views
4 votes
What is the code? im stuckk

What is the code? im stuckk-example-1

2 Answers

3 votes

Answer:

sum = 0

count = 0

while sum < 200:

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

sum += number

count += 1

print("\\Sum:", sum)

print("Number's Entered:", count)

Step-by-step explanation:

The while loop will keep running until the sum is greater than 200. The sum will be added to the number that the user inputs and the count will be added by 1. Once the sum is greater than 200, the program will print the sum and the count of how many numbers were entered.

User Nuicca
by
5.0k points
4 votes

sum=0

c=0

while(1):

tmp = int(input("Enter a number: "))

sum+=tmp

c+=1

if(sum>200):

print("\\Sum:",sum,"\\Total number entered:",c)

break

else:

continue

What is the code? im stuckk-example-1
User Luc Gendrot
by
4.5k points