Python program to find the largest digit of a given number


Write a program in python to find the largest digit of a given number

---------------------------------------

n=int(input("Enter any Number : "))

max=0

while n>0:

    digit=n%10

    if max<digit:

      max=digit

      n=n//10

print("Largest Digit is : ",max)

---------------------------------------

Output :-

Enter any Number : 4589

Largest Digit is :  9

Post a Comment

0 Comments