Computer Fundamental
วันพฤหัสบดีที่ 24 กันยายน พ.ศ. 2558
lab 5 : Find sum of values in array
def setup():
n=[2,5,9,4,6,8,7,10,1,1,9,1]
print("sum of value = ",findsum(n))
def findsum(n):
i=0
sumArray=0
while(i<len(n)):
sumArray=sumArray+n[i]
i=i+1
return sumArray
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น