LEAP YEAR
void setup() {
size(500, 500);
background(255);//white
calculate(2016);//calculate the date
}
void calculate(int year_input) {
int posx=80;
int posy=250;
textSize(30);
fill(0);//black
////fucntion calculation////
if (year_input%4!=0) {
text(year_input+" isn't the Leap Year", posx, posy);
} else if (year_input%100!=0) {
text(year_input+" is the Leap Year", posx, posy);
} else if (year_input%400==0) {
text(year_input+" is the Leap Year", posx, posy);
} else{
text(year_input+" isn't the Leap Year", posx, posy);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น