void setup() {
size(300, 300);
}
void draw() {
background(255);
frameRate(1);
fill(0);
textSize(30);
text("Leap Year Calculator", 0, 50);
year=year+1;
calculate_year();
textSize(50);
text("Year : "+year, 5, 150);
}
void calculate_year () {
int mod4 = year%4;
int mod100 = year%100;
int mod400 = year%400;
textSize(35);
if (mod4 == 0) {
if (mod100 != 0) {
fill(84, 129, 230);
text("Leap Year", 60, 200);
} else if (mod100 == 0) {
if (mod400 != 0) {
fill(241, 95, 116);
text("Not A Leap Year", 10, 200);
} else if (mod400 == 0) {
fill(84, 129, 230);
text("Leap Year", 60, 200);
}
}
} else if (mod4 != 0) {
fill(241, 95, 116);
text("Not A Leap Year", 10, 200);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น