Monday, July 2, 2018

C program to check if Leap year

    /*

     * C program to find whether a given year is leap year or not

     */
     #include<stdio.h>

    void main()

    {

        int year;



        printf("Enter a year \n");

        scanf("%d", &year);

        if ((year % 400) == 0)

            printf("%d is a leap year \n", year);

        else if ((year % 100) == 0)

            printf("%d is a not leap year \n", year);

        else if ((year % 4) == 0)

            printf("%d is a leap year \n", year);

        else

            printf("%d is not a leap year \n", year);

    }

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...