193k views
3 votes
Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex: If the input is: 2000 2 Then the output is: 1000 500 250

User Geeky I
by
7.1k points

1 Answer

2 votes

Answer:

The program written in Python is as follows:

user_num = int(input("Number: "))

x = int(input("x: "))

for i in range(1,4):

user_num = user_num/x

print(user_num," ")

Step-by-step explanation:

This line gets user_input from the user

user_num = int(input("Number: "))

This line gets x from the user

x = int(input("x: "))

This line iterates from 1 to 3

for i in range(1,4):

This line divides user_num by x

user_num = user_num/x

This line prints the result of the division

print(user_num," ")

User Oliwia
by
7.3k points