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

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad