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/ Explanation:

Enter a number :4925

Smallest digit :  2

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad