Home > Back-end >  o
o

Time:11-20

Can you help me take a look at this how to make a mistake
#include
Int isLeap (int year)//determine whether for leap years
{
If (year %==0 100 | | year % 4==0)
return 1;
The else
return 0;
}

During the int daysInMonth (int, int the month)//judgment upon a number of days
{
Int I;
I=isLeap (year);
If (I==1)
{
The switch (month)
{
Case 1:
Case 3:
Case 5:
Case 7:
Case 8:
Case 10:
Case 12: printf (" 31 days \ n "); break;
Case 2: printf (" 29 days \ n "); break;
Case 4:
Case 6:
Case 9:
Case 11: printf (" 30 days \ n "); break;
}
}
If (I==0)
{
The switch (month)
{
Case 1:
Case 3:
Case 5:
Case 7:
Case 8:
Case 10:
Case 12: printf (" 31 days \ n "); break;
Case 2: printf (" 28 days \ n "); break;
Case 4:
Case 6:
Case 9:
Case 11: printf (" 30 days \ n "); break;
}
}
}

During the int isLegal (int, int the month, int day//whether the date legal
{
Int I, j=1, k;
I=isLeap (year);
K=daysInMonth (year, month);
If ((month<=0 | | month>=13) | | (day<=0 | | day> 31))
j=0;
The else
{
If (I==1)
{
If (month<1 | | month> 12)
j=0;
If (the month==4 | | the month 6==| | 9 month==| | the month==11)
{
If (day> 30 | | day<=0)
j=0;
}
If (the month==2)
{
If (day<=0 | | day> 29)
j=0;
}
}
If (I==0)
{
If (month<1 | | month> 12)
j=0;
If (the month==4 | | the month 6==| | 9 month==| | the month==11)
{
If (day<=0 | | day> 31)
j=0;
}
If (the month==2)
{
If (day<=0 | | day> 28)
j=0;
}
}
}
Return j;
}

During the int Num (int, int the month, int day
{
Int I, sum;
I=isLeap (year);
The switch (month)
{
Case 1: the sum=0; break;
Case 2: sum=31; break;
Case 3: the sum=59; break;
Case 4: sum=90; break;
Case 5: sum=120; break;
Case 6: sum=151; break;
Case 7: sum=181; break;
Case 8: sum=212; break;
Case 9: sum=243; break;
Case 10: sum=273; break;
Case 11: sum=304; break;
Case 12: sum=334; break;
}
Sum=sum + day;
If (I==1 & amp; & Month> 2)
{
Sum++;
}
return sum;
}

Int main ()
{
int year,month,day;
int a,b,c;
A=isLeap (year);
B=isLegal (year, month, day);
If (b==0)
{
Do
{
Printf (" please enter the correct date format \ n ");
The scanf (" % d % d - % d ", & amp; Year, & amp; The month, & amp; Day);
} while (b==1);
}
C=Num (year, month, day);
Printf (" the date is the first % d day of the year ", c);
Printf (" % d ", b);
}