Programming Examples
Python program to find the smallest digit of the input number
Write a Python code to input a number and find the smallest digit of the input number.
Sample Input: 6524
Sample Output: Smallest digit is 2.
Solution:
n=int(input("Enter a number :"))
min=n%10
while(n>0):
r=n%10
if(r<min):
min=r
n=n//10
print("Smallest digit : ",min)
Output
Enter a number :4925
Smallest digit : 2