วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

Lab 3 : Leap Year

void setup() {
  size(500, 500);
  background(0);

  int year=2013;
  cal_year(year);

  fill(#1FFC6A);
  textSize(80);
    text("Leap Year", 60, 150);
  textSize(50);
    text("Year : "+year, 110, 250);
}

void cal_year(int year) {

  int x=100;
  int y=350;

  textSize(40);
  fill(#FF0000);
  if (year%4==0 || year%4==0 && year%100!=0 || year%4==0 && year%100==0 && year%400==0){
    text("Year's Leap Year", x-10, y);
  }
  if(year%4!=0 || year%4==0 && year%100==0 || year%4==0 && year%100==0 && year%400!=0){
    text("Year isn't Leap Year",x-30,y);
  }
}

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

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