Home > Back-end > To solve, why code inspection without running out what also have no wrong
To solve, why code inspection without running out what also have no wrong
Time:09-29
This is for class on the problem, here is my code, run out what also have no #include Int main () { Int year=2008; Int the month=8; Int day=8; Int flag; Int sum; If (year % 4==0 & amp; & Year %==0 100 | 100 year %==0 & amp; & Year % 4!=0) Flag=1; The else flag=0; The switch (month) { Case 1: the sum=(31); break; Case 2: sum=(sum + 28); break; Case 3: the sum=(sum + 31); break; Case 4: sum=(sum + 30); break; Case 5: sum=(sum + 31); break; Case 6: sum=(sum + 30); break; Case 7: sum=(sum + 31); break; Case 8: sum=(sum + 31); break;//use eight days to add here, but with the 31-23 case 9: sum=(sum + 30); break; Case 10: sum=(sum + 31); break; Case 11: sum=(sum + 30); break; Case 12: sum=(sum + 31); break; The sum -=23 + flag;//sum -=23 mean by August 31-23 days equals eight days Printf (" % d % d % d (is the first of the year "% d days, year, month, day, sum); } return 0; } Because paste effect is not good, there is a picture below, the answer is 221 days
CodePudding user response:
Printf (" % d % d % d (is the first of the year "% d days, year, month, day, sum); This print to switch to use print outside