# 三个数找最大值 |
max_1 = int ( input ( "请输入第一个数:" )) |
max_2 = int ( input ( "请输入第二个数:" )) |
max_3 = int ( input ( "请输入第三个数:" )) |
if max_1 > max_2 and max_1 > max_3 : |
if max_2 > max_3: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_1,max_2,max_3)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_3,max_2,max_1)) |
print ( "最大值:%d" % max_1) |
elif max_3 >max_2: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_1,max_3,max_2)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_1,max_3,max_2)) |
print ( "最大值:%d" % max_1) |
elif max_2 > max_1 and max_2 > max_3: |
if max_1 > max_3: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_2,max_1,max_3)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_3,max_1,max_2)) |
print ( "最大值:%d" % max_2) |
elif max_3 > max_1: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_2,max_3,max_1)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_1,max_3,max_2)) |
print ( "最大值:%d" % max_2) |
elif max_3 > max_2 and max_3 > max_1: |
if max_2 > max_1: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_3,max_2,max_1)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_1,max_2,max_3)) |
print ( "最大值:%d" % max_3) |
elif max_1 > max_2: |
print ( "三个数值由大到小排列:%d,%d,%d" % (max_3,max_1,max_2)) |
print ( "三个数值由小到大排列:%d,%d,%d" % (max_2,max_1,max_3)) |
print ( "最大值:%d" % max_3) |
else : |
print ( "ERROR!" ) |