Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- leap_year.c
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- int is_leap_year(int year)
- {
- return !(year % 4) && (year % 100 || !(year % 400));
- }
- int main(void)
- {
- int i;
- for(i=1997; i<2030; i++)
- {
- printf(" %d ", i);
- if( is_leap_year(i) )
- printf(" is leap year. \n");
- else
- printf(" isn't leap_year. \n");
- }
- return 0;
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement