Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mbed.h"
- 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;
- }
- int main() {
- int year = 2008;
- int days = 366;
- while (days > 365)
- {
- if (IsLeapYear(year))
- {
- if (days > 366)
- {
- days -= 366;
- year += 1;
- }
- else
- break;
- }
- else
- {
- days -= 365;
- year += 1;
- }
- }
- printf("end\n");
- }
Add Comment
Please, Sign In to add comment