Home > Back-end >  Struck a code output specifies the number of days in February, the output is wrong, but I don't
Struck a code output specifies the number of days in February, the output is wrong, but I don't

Time:11-09

Subject content: input year, month, the output this month how many day

Input: two integers

Output: the corresponding number of days in

Example 1: input output 28 2018 2
# include
Int main () {
Int a, b, c, d;
The scanf (" % d % d ", & amp; A, & amp; B);
If ((a % 4==0) & amp; & (a % 100==0) | | (a % 400==0)) {
If (b==2)
C=29;
If (b==1 | |==3 b | | b==5 | | b==7 | |==8 b | | b==10 | | b==12)
C=31;
If (b=4 | |==6 b | | 9 b==| | b==11)
C=30;
}
Else if (b==2);
C=30;
If (b==1 | |==3 b | | b==5 | | b==7 | |==8 b | | b==10 | | b==12)
C=31;
Else if (b=4 | |==6 b | | 9 b==| | b==11)
C=30;
The else printf (" % d ", c);
return 0;
}
  • Related