วันจันทร์ที่ 7 กันยายน พ.ศ. 2558

Lab 3 - Leap Year


void setup(){
  size(400,400);
  background(255);
  textAlign(CENTER);
  textSize(30);
  fill(0,0,255);
  text("LEAP YEAR",width/2,50);
}

void draw(){
  leap_year(2016);
}

void leap_year(int x){

  if(x%4==0&&x!=0||x%400==0){
    fill(0,255,0);
    text(x+" is Leap Year",width/2,height/2);
  } else{
    fill(255,0,0);
    text(x+" isn't Leap Year",width/2,height/2+30);
  }
  }

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

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