19.8k views
3 votes
Create a program that prompts the user for three integers, then outputs the numbers in descending order. For example, if the user enters: 32 85 3 Output: 85 32 3 For the video: use 45 32 90; then 200,52650, 52650; then 3, 3, 532.

1 Answer

5 votes

Final answer:

The problem can be solved by writing a Python program that takes three integers as input, sorts them in descending order, and then prints the results. Using the given examples, the program correctly outputs the numbers in descending order as requested by the user.

Step-by-step explanation:

To create a program that outputs three integers in descending order, we can prompt the user for input and then use logic to arrange the numbers. Here's a simple Python program that does exactly that:

number1 = int(input('Enter the first integer: '))
number2 = int(input('Enter the second integer: '))
number3 = int(input('Enter the third integer: '))

numbers = [number1, number2, number3]
numbers.sort(reverse=True)

print('Output:', numbers[0], numbers[1], numbers[2])

This program takes three user inputs, places them in a list, sorts the list in descending order, and prints the result. For educational purposes, let's run the program with the provided examples:

  • Input: 45 32 90 — Output: 90 45 32
  • Input: 200,52650, 52650 — Output: 52650 52650 200
  • Input: 3, 3, 532 — Output: 532 3 3

User Yasen
by
8.0k points