C program to check a year is a leap year or not


#include <stdio.h>
int main()
{
    int year;
    printf("Enter the year: ");
    scanf("%d", &year);
    if(year%400==0)
    {
        printf("%d is a leap year", year);
    }
    else if(year%100==0)
    {
         printf("%d is not a leap year", year);
    }
    else if(year%4==0)
    {
         printf("%d is a leap year", year);
    }
    else{
         printf("%d is not a leap year", year);
    }
    return 0;
}

Comments

Popular posts from this blog

Automations and robotics

Palindrome Pattern Program In Java Language

Rhombus Pattern Program In Java Language