C programming
int main()
{
int year;
printf("Enter Year : ");
scanf("%d",&year);
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("%d is a leap year", year);
else
printf("%d is not a leap year", year);
return 0;
}
Try it Yourself ➠
Leap year or not in C
26 July
0
Write a program (WAP) in C to know a year is Leap year or not.
#include <stdio.h>int main()
{
int year;
printf("Enter Year : ");
scanf("%d",&year);
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("%d is a leap year", year);
else
printf("%d is not a leap year", year);
return 0;
}
Try it Yourself ➠
OutPut : 1 |
OutPut : 2 |
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment