返回列表 發帖

計算總和 (一)

計算 1+2+3+…+10 之和

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼
  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;   #sum=sum+i
  4. print("1+2+3+...+10={}".format(sum))
複製代碼

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.    sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(333,1000,3):
  3.     sum+=i
  4. print("333+3+3...+3=%d"%sum)
複製代碼

TOP

  1. a=0
  2. for i in range(1,11):
  3.     a+=i
  4. print("1+2+3+...+10之和=",a,sep="")
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;   #sum=sum+i
  4. print("1+2+3...+10={}".format(sum))
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;   #sum=sum+i
  4. print("1+2+3+...+10={}".format(sum))
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;   #sum=sum+i
  4. print("1+2+3+...+10={}".format(sum))
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i
  4. print("1+2+3+...+10=",sum,sep="")
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print(":1+2+3...+10=:%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i
  4. print("1+2+3+4+5+6+7+8+9+10="+str(sum))   
複製代碼
._.

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i
  4. print("1+2+....+10=",sum,sep="")
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

  1. sum=0
  2. for i in range(1,11):
  3.     sum+=i;
  4. print("1+2+3+...+10=%d"%sum)
複製代碼

TOP

返回列表