Computer Science, asked by shahissain, 1 year ago

write the Python coding to accept two numbers and print in sorting order (minimum to maximum using if else statement)​

Answers

Answered by gurukulamdivya
0

Answer:

x = int(input("Input first number: "))

y = int(input("Input second number: "))

a1 = min(x, y)

a3 = max(x, y)

a2 = (x + y ) - a1 - a3

print("Numbers in sorted order: ", a1, a2, a3)

I HOPE THIS HELPED YOU SO PLZ RATE ACCORDINGLY

Answered by fiercespartan
0

We will need to take two inputs and print them in ascending order using if-else statement.

First, let's get done with taking inputs.

num1 = int(input('Enter your first number:'))

num2 = int(input('Enter your second number:'))

Now, we will have to use the if-else statement. The way we use is to first see which number is greater and then write the print command. Here it is:

if num1 > num2:

   print(num2,num1)

elif num2 > num1

   print(num1,num2)

else:

   print('Both numbers are equal')

I added an elif statement because there might be a chance of these 2 numbers being equal.

Similar questions