第13481题 单选题
给定Python累加代码(仅输入正负整数或0),下列相关说法错误的是?
Sum = 0
N = int(input())
while N:
    Sum += N
    N = int(input())
print(Sum)
A

执行上面代码如果输入0,将终止循环

B

执行上面代码能实现所有非0整数的求和

C

执行上面代码第一次输入0,最后将输出0

D

执行上面代码将陷入死循环,可将while N: 改为while N==0:

程序运行统计
暂无判题统计