20 กันยายน 2558

Lab4x Sum of Integers

def setup():
   max_val = 10
   count=0
   result=0
   while (count <= max_val):
      result += count
      count+=1
   print("Sum of Integers from 1 to",max_val,"=",end="")
   print(" '",result,"'",sep="")
setup()

ไม่มีความคิดเห็น:

แสดงความคิดเห็น