วันพุธที่ 16 กันยายน พ.ศ. 2558

Lab 4x : Leap year

def setup():
   print("Leap Year Calculator")
   calculate_year()

def calculate_year ():
   year = 1995
   mod4 = year%4
   mod100 = year%100
   mod400 = year%400
   if (mod4 == 0):
      if (mod100 != 0):
         print(year," : Leap Year")
      elif (mod100 == 0):
         if (mod400 != 0):
            print(year," : Not A Leap Year")
         elif (mod400 == 0):
            print(year," : Leap Year")
   elif (mod4 != 0):
      print(year," : Not A Leap Year")
     
setup()

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

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