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

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials 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 Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz