Q.Write a function that takes two numbers and returns the number that has minimum one's digit.

[For example, if numbers passed are 491 and 278, then the function will return 491 because it has got minimum one's digit out of two given numbers (491's 1 is < 278's 8)].


You can understand by Watching video :-



Answer :-

def min(x , y ) :
    a = x % 10
    b = y % 10
    if a < b :
        return x
    else :
        return y

first = int(input("Enter first number = "))
second = int(input("Enter second number = "))

print ( "Minimum one's digit number = " , min( first , second ) )

Output :-

Enter first number = 491
Enter second number = 278
Minimum one's digit number =  491

>>> 

Enter first number = 45656
Enter second number = 5418
Minimum one's digit number =  45656

>>> 

Enter first number = 9674
Enter second number = 5431
Minimum one's digit number =  5431

>>> 

Enter first number = 165
Enter second number = 634
Minimum one's digit number =  634

>>>


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post