User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

If14. Three numbers are given. Output first the smallest, and then the largest of these numbers.

Solution in Python 3:

import random

A = random.randrange(-30,30)
B = random.randrange(-30,30)
C = random.randrange(-30,30)

print("Число A:", A)
print("Число B:", B)
print("Число C:", C)

if A < B:
mn = A
mx = B
mn = B
mx = A

if mx < C:
mx = C

if mn > C:
mn = C

print("Minimum:", mn)
print("Maximum:", mx)