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 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad