# 偶数,能被2整除的数 num%2 ==0 sum=0 i=2 # 1-100之间第一个偶数 while i<=100: if i%2 ==0: sum+=i i+=2 print('求和的结果为:',sum)