Program 13 ADD DAYS
Program 13 ADD DAYS
_____________________________________________
import java.util.Scanner;
int[] daysInMonth = {31, 28, 31, 30, 31, 30, 31, 31,
30, 31, 30, 31};
day += daysToAdd;
while (day > daysInMonth[month - 1]) {
day -= daysInMonth[month - 1];
month++;
if (month > 12) {
month = 1;
year++;
daysInMonth[1] = (year % 4 == 0 && (year %
100 != 0 || year % 400 == 0)) ? 29 : 28;
}
}
OUTPUT
_____________________________________________
Variable Table
_____________________________________________