Showing posts with label leap year in c++. Show all posts
Showing posts with label leap year in c++. Show all posts

Tuesday, November 28, 2017

Leap Year Checker in C

A program that I wrote using C language that will ask the user to give a year and then our program will check if the given year is a leap year or not.

I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.





Sample Program Output


Program Listing

leap.c


#include <stdio.h>

int main()
{
    int year=0;

    printf("Leap Year Checker in C");
    printf("\n\n");
    printf("Give a Year:  ");
    scanf("%d",&year);
   if(year%4 == 0)
        {
        if( year%100 == 0)
        {

            if ( year%400 == 0) {
                printf("\n\n");
                printf("The given %d is a leap year.", year);
                printf("\n\n");
                printf("End of Program");
                printf("\n\n");
            }
            else {
                printf("\n\n");
                printf("The given %d is not a leap year.", year);
                printf("\n\n");
                printf("End of Program");
                printf("\n\n");
            }
        }
        else {
            printf("\n\n");
            printf("The given %d is a leap year.", year );
            printf("\n\n");
            printf("End of Program");
            printf("\n\n");
        }
    }
    else {
        printf("\n\n");
        printf("The given %d is not a leap year.", year);
        printf("\n\n");
        printf("End of Program");
        printf("\n\n");
    }

    return 0;
}