Adding up numbers
Reads three numbers with input(), converts them with int() and prints the total.
Input and outputLoops
// Add up three numbers
total = 0
for i = 1 to 3
number = int(input("Enter a number: "))
total = total + number
next i
print("Total: " + str(total))- Inputs
- 4, 5, 6
- Output
Total: 15