Programming Examples

Python program to find the largest digit of a given number


Write a python program to accept a integer number form user and find the largest digit of number.

Sample:

Input : 12341

Output : Largest Digit is : 4

Solution

num=int(input("Enter any Number : "))
max=0
while num>0:
    digit=num%10
    if max<digit:
        max=digit
    num=num//10
print("Largest Digit is : ",max)
Output

Enter any Number : 23241

Largest Digit is :  4


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