N=int(input())
max=0
for i in range(N):
m=int(input())
if m>max:
max=m
if N<=0:
print("ERROR")
else:
print("max={}".format(max))

python中输入N个数求最大值?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- CSDN专家-天际的海浪 2021-05-04 16:47关注
N=int(input()) max=0 for i in range(N): m=int(input()) if m>max: max=m if N<=0: print("ERROR") else: print("max={}".format(max))
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 5无用 2