Program to Check Century & Leap Year

-- Leave a Comment
Hello Here is C program to check If the year entered by user is century Year or not. First we check if the year is Century then check if it is leap or not. And for other check Leap year.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
main()
{
    int year;
    printf("Enter the Year you want to check:- ");
    scanf("%d",&year);
    if(year % 100 ==0)
    {
        if (year % 400 == 0)
        printf("Century Leap Year");
        else
        printf("Not a leap year");
    }
    else
    {
        if(year % 4 == 0)
        printf("Leap Year");
        else
        printf("Not a leap year");

    }
}

And I think you understand this code.

Hello This is Sagar Devkota. Studying Bachelor of Software Engineering at Pokhara University. I know something about Linux, Android, Java, Nodejs, Unity3D and 3 dots :)

0 comments:

Post a Comment