Write Python program to input three number and print in ascending order

"> PYTHON PROGRAM TO INPUT THREE NUMBER AND PRINT IN ASCENDING ORDER

Programming Example

Write Python program to input three number and print in ascending order

Solution

num1=int(input("Enter First number : "))
num2=int(input("Enter Second number : "))
num3=int(input("Enter Third number : "))
if num1<num2 and num1<num3:
    if num2<num3:
        x,y,z=num1,num2,num3
    else:
        x,y,z=num1,num3,num2
elif num2<num1 and num2<num3:
    if num1<num3:
        x,y,z=num2,num1,num3
    else:
        x,y,z=num2,num3,num1
else:
    if num1<num2:
        x,y,z=num3,num1,num2
    else:
        x,y,z=num3,num2,num1
print("Numbers in ascending order are : ",x,y,z)
Output

Enter First number : 50

Enter Second number : 45

Enter Third number : 100

Numbers in ascending order are :  45 50 100

>>> 

======================== 

Enter First number : 30

Enter Second number : 20

Enter Third number : 10

Numbers in ascending order are :  10 20 30

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 NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad