[圖解C] ex 5-3

#include <stdio.h>
#include <stdlib.h>

int main()
{
    // AD 4, 8, 400, 1600, 2000 are Leap Years
    int year;
   
    printf("enter the year (ex:1996): ");
    scanf("%d", &year);
   
    if (year % 400 == 0)
       printf("AD %d is a Leap Year.\n", year);
    else if (year % 100 == 0)
       printf("AD %d is not a Leap Year.\n", year);
    else if (year % 4 ==0)
       printf("AD %d is a Leap Year.\n", year);
    else
       printf("AD %d is not a Leap Year.\n", year);
   
    system("pause");
    return 0;
}