Python Program to find the smallest digit of a number
In this program, You will learn how to find the smallest digit of a number in Python.
1234 => 1
8973 => 3
Example: How to find the smallest digit of a number in Python.
n = int(input("Enter a number:"))
sd = 9
while n > 0:
r = n % 10
if sd > r:
sd = r
n = int(n / 10)
print("Smallest digit:", sd)
Output:
Enter a number:4356
Smallest digit: 3