Advertisement
STANAANDREY

is leap year

Nov 10th, 2023
1,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int isLeapYear(int year) {
  4.     if (year % 4 == 0) {
  5.         if (year % 100 == 0) {
  6.             if (year % 400 == 0) {
  7.                 return 1;
  8.             } else {
  9.                 return 0;
  10.             }
  11.         } else {
  12.             return 1;
  13.         }
  14.     } else {
  15.         return 0;
  16.     }
  17. }
  18.  
  19. int main() {
  20.     int year;
  21.     scanf("%d", &year);
  22.     printf("%d\n", isLeapYear(year));
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement