Write a Python program which takes a number and prints the digits from the unit place, then the tenth, then hundredth, etc. (Right to Left)
[Consider the input number to be an INTEGER. You are not allowed to use String indexing for solving this task]
Example: If the user gives 32768, then print 8, 6, 7, 2, 3
num = int(input("Input number: "))
print('Output:')
while (num > 10):
digit = num % 10
num = num // 10
print(f'{digit}, ', end='')
digit = num % 10 # last digit
print(f'{digit}')
Comments
Leave a comment