Leap year program In C using if-else

This “Leap Year Program in C” post providing how to implement program to check the given input number is Leap year or not using if-else block or if-else-if block in c language.


#include<stdio.h>
void main()
{
int y ;
printf(“Enter year : “);
scanf(“%d”, &y);
if(y%400==0 && y%100 ==0 || y%4==0 && y%100 != 0)
printf(“%d is Leap year”, y);
else
printf(“%d is not a leap year”, y);
}


#include<stdio.h>
void main()
{
int y ;
printf(“Enter year : “);
scanf(“%d”, &y);
if(y%400==0)
printf(“%d is Leap year”, y);
else if(y%4==0 && y%100 != 0)
printf(“%d is Leap year”, y);
else
printf(“%d is not a leap year”, y);
}


Flow Chart :

Leap year program using C syntax

Leap Year Program Using C

Share this