วันอาทิตย์ที่ 25 ตุลาคม พ.ศ. 2558

Lab 5: Find the maximum value in array

def setup():
   n = [ 1, 8, 7, 12, 3, 6, 9 ]
   i = 0
   numMax = 0
   while(i<len(n)):
      if(numMax<n[i]):
         numMax = n[i]
      i = i+1
   print("Maximum :",numMax)

setup()

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

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