Wednesday, April 24, 2019

C program to find leap year | Easy Way

c program to find leap year


Leap year is very interesting program in C . New programmers are confused how to find out a leap year easily you can easily find out the best way to c program to find leap year with source code given below .



//www.programizbasic.blogspot.com
#include <stdio.h>

int main()
{
    int year;

    printf("\n Enter the year (4 digit to check ): ");

    scanf("%d",&year);

    if(year%400 == 0 || (year % 100 != 0 && year%4 == 0))
        printf("%d is a leap year: ",year);
    else
        printf("%d is not a leap year",year);

    return 0;
}
OUTPUT:

c program to find leap year

Explain:

C program to find leap year . Take a integer variable year and then use if else condition for check the value is leap year or not if the value is leap year out will be show value is leap year if not show the out put not a leap year.

No comments:

Post a Comment

Post Top Ad

Pages