sum = 0 i = 1 while i<=100: sum = sum + i i += 1 print('1到100累积和:%d'% sum)登入後複製輸出結果為5050登入後複製