Skip to content

Commit 6144dd1

Browse files
authored
Create Leap year program using functions.c
1 parent 1e4d9d9 commit 6144dd1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <stdio.h>
2+
3+
void is_leap_year(int year)
4+
{
5+
if(year%4 == 0)
6+
{
7+
if( year%100 == 0)
8+
{
9+
if ( year%400 == 0)
10+
printf(“%d is a leap year”, year);
11+
else
12+
printf(“%d is not a leap year”, year);
13+
}
14+
else
15+
printf(“%d is a leap year”, year);
16+
}
17+
else
18+
printf(“%d is not a leap year”, year);
19+
printf(“\n”);
20+
}
21+
22+
int main()
23+
{
24+
int year;
25+
printf(“\nEnter a year : “);
26+
scanf(“%d”,&year);
27+
printf(“\n”);
28+
is_leap_year(year);
29+
return 0;
30+
}
31+
32+
/* Output
33+
Input- Enter a year:1998 Output- 1998 is not a leap year
34+
/*

0 commit comments

Comments
 (0)