9 กันยายน 2558

Lab3 Leap Year

void setup() {
  int year = 2015;
  size(270, 80);
  background(0);
  fill(255);
  textAlign(CENTER);
  textSize(25);

  if (year%400==0) {
    text(year+" is "+"leap year", width/2, height/2 );
  } else if (year%100==0) {
    text(year+" isn't "+"leap year", width/2, height/2 );
  } else if (year%4==0) {
    text(year+" is "+"leap year", width/2, height/2 );
  } else {
    text(year+" isn't "+"leap year", width/2, height/2 );
  }
}

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

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