Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to make statement by using putty... but I\'m having trouble making i

ID: 3630691 • Letter: I

Question

I'm trying to make statement by using putty... but I'm having trouble making it..
(When you answer, you CANNOT use Loop Function such as While or for)
(You need to use multy-way selection switch, such as if/else if and case/break)

If I finish make the program and type a.out filename.., I should see "Enter the year: " and "Enter the day number: "

So, I put the year as 2011 and day number as 15
and, the following resuly should be like the below
Day #: 15
January 15, 2011

for another example, I put year as 2008 and day number as 60, I should get

Day #: 60
February 29, 2008

for the last example, I put year as 2011 and day number as 60, I should get
Day #: 60
March 1, 2011

I also need to use Leap function (Leap Year) in order to make the program result like the above...
Please make the proper statement based on putty system so that I can get those result.

Explanation / Answer

Here's one with just if/else-if and and no arrays. #include /* Returns 1 if the year is a leap year and 0 otherwise */ int isLeapYear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) { return 1; } else { return 0; } } else { return 1; } } else { return 0; } } void printLine(char* month, int day, int year) { printf("%s %d, %d ", month, day, year); exit(0); } int main() { int year; int dayNumber; int februaryDays = 28; printf("Enter the year: "); scanf("%d", &year); printf("Enter the day number: "); scanf("%d", &dayNumber); printf("Day #: %d ", dayNumber); if (isLeapYear(year)) { februaryDays++; } int daysLeft = dayNumber; /* January */ if (daysLeft 31) { daysLeft -= 31; if (daysLeft februaryDays) { daysLeft -= februaryDays; if (daysLeft 31) { daysLeft -= 31; if (daysLeft 30) { daysLeft -= 30; if (daysLeft 31) { daysLeft -= 31; if (daysLeft 30) { daysLeft -= 30; if (daysLeft 31) { daysLeft -= 31; if (daysLeft 31) { daysLeft -= 31; if (daysLeft 30) { daysLeft -= 30; if (daysLeft 31) { daysLeft -= 31; if (daysLeft 30) { daysLeft -= 30; if (daysLeft