14) A leap year in the Gregorian calendar is a year in which February has 29 day
ID: 3694123 • Letter: 1
Question
14)
A
leap
year in the Gregorian calendar is a year
in which February has 29 days
instead of the usual 28 days.
These special extra days were added in
1582
to
keep the
calendar year
synchronized with the
astronomical
or
seasonal yea
r
.
According to
Wikipedia:
Every year that is exactly divisible by
4
is a leap year,
except
for year
s that are exactly
divisible by
100, but
years
divisible by 100
are
leap years if they are exactly divisible by
400. For example, the years 1700, 1800, and 1900 are not leap years, but the year 2000
is
.
Note that before the Leap Year system was developed in 1582, Leap Years did
not exist,
so
any year before 1582 can never be a le
ap year
!
For example:
2000 was a leap year. 2400 will be a leap year. 2004, 2008 and 2016 are all
leap years as well.
Write a function that accepts an integer year
value
and returns 1 if it is a Leap Year and 0
if it is not
following
this
function prototype
:
int isLeapYear(int);
write it in c program!!!!!!!
Explanation / Answer
#include<stdio.h>
int main() {
int year;
printf("Enter a year :");
scanf("%d",&year);
if(year%4==0)
{
if(year%100==0)
{
if(year%400==0)
printf("%d is a leap year", year);
else
printf("%d is not a leap year",year);
}
else
printf("%d is a leap year",year);
}
else
printf("%d is not a leap year", year);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.