51Testing软件测试论坛

标题: 用while循环计算 1 到 100 的整数和? [打印本页]

作者: 测试积点老人    时间: 昨天 09:36
标题: 用while循环计算 1 到 100 的整数和?
回复可见


作者: 你好浮戈    时间: 2 小时前
sum_of_numbers = 0
counter = 1  

while counter <= 100:
    sum_of_numbers += counter  
    counter += 1  

print(sum_of_numbers)
作者: kallinr    时间: 2 小时前

sum_of_numbers = 0
counter = 1  

while counter <= 100:
    sum_of_numbers += counter  
    counter += 1  

print(sum_of_numbers)
作者: oliver.tang    时间: 1 小时前
while
作者: 海海豚    时间: 1 小时前
sum_of_numbers = 0
counter = 1  
while counter <= 100:
    sum_of_numbers += counter  
    counter += 1  

print(sum_of_numbers)
作者: litingting0214    时间: 1 小时前
sum_of_numbers = 0
counter = 1  
while counter <= 100:
    sum_of_numbers += counter  
    counter += 1  

print(sum_of_numbers)




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2