68.8k views
2 votes
Write a program that reads integers user_num and div_num as input, and outputs user_num divided by div_num three times using floor divisions. For example, if the input is 2000 2, the output is 1000 500 250. What is the output when user_num is divided by div_num three times using floor divisions?

2 Answers

2 votes

Final answer:

To write a program that reads integers user_num and div_num as input, and outputs user_num divided by div_num three times using floor divisions, you can use a loop to repeat the division process three times. Here is an example in Python.

Step-by-step explanation:

To write a program that reads integers user_num and div_num as input, and outputs user_num divided by div_num three times using floor divisions, you can use a loop to repeat the division process three times. Here is an example in Python:



user_num = int(input('Enter a number: '))
div_num = int(input('Enter another number: '))

for i in range(3):
result = user_num // div_num
print(result)
user_num = result



For example, if the input is 2000 2, the output would be 1000 500 250.

User Alfwatt
by
8.3k points
1 vote

Final answer:

The student's question pertains to the creation of a program that performs floor division, where the result is rounded down to the nearest integer. When dividing 1.9436 by 10, 100, and 1000 using floor division, the result each time is 0, as the quotient is less than 1 and is rounded down.

Step-by-step explanation:

The subject of the question relates to creating a computer program that performs floor division operations.

The concept of floor division is essentially a floor operation where the result of the division is rounded down to the nearest whole number.

For example, if 1.9436 is divided by 1000, the outcome is 0.0019436, but when dealing with floor division, the decimals are ignored, and we only consider the integer part of the quotient.

Therefore:

1.9436 ÷ 10 = 0.19436 but with floor division would be 0 (since 0.19436 is less than 1)

1.9436 ÷ 100 = 0.019436 but with floor division would be 0 (since 0.019436 is less than 1)

1.9436 ÷ 1000 = 0.0019436 but with floor division would be 0 (since 0.0019436 is less than 1)

User Tomzi
by
8.0k points