2022-10-11 19:27:51 +00:00
|
|
|
def max2(x, y):
|
|
|
|
if x > y:
|
|
|
|
return x
|
|
|
|
else:
|
|
|
|
return y
|
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
|
2022-10-11 19:27:51 +00:00
|
|
|
def max3(x, y, z):
|
|
|
|
return max2(x, max2(y, z))
|
|
|
|
|
2023-05-16 20:00:37 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
def main():
|
|
|
|
n1 = float(input('Introduza dois valores.\nN1: '))
|
|
|
|
n2 = float(input('N2: '))
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
print('\nO maior valor é: ', max2(n1, n2))
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
n1 = float(input('\n\nIntroduza tres valores.\nN1: '))
|
|
|
|
n2 = float(input('N2: '))
|
|
|
|
n3 = float(input('N3: '))
|
2022-10-11 19:27:51 +00:00
|
|
|
|
2022-10-18 17:18:56 +00:00
|
|
|
print('\nO maior valor é: ', max3(n1, n2, n3))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-05-16 20:00:37 +00:00
|
|
|
main()
|