Counting Down

In an attempt to demonstrate division to a primary class, you use the following python program to calculate \(1 \div 0.1\).

1
2
3
4
5
6
7
8
9
dividend = 1
divisor = 0.1
quotient = 0

while divisor != 0:
   dividend -= divisor
   quotient += 1

print quotient

What does the program output?


Inspired by Currency Calculations

×

Problem Loading...

Note Loading...

Set Loading...