forked from Varshini98/git-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleap.c
More file actions
35 lines (28 loc) · 630 Bytes
/
leap.c
File metadata and controls
35 lines (28 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*********
Author1 Name:
Author2 Name:
FIXED THE BUGS FOR GIT-WORKSHOP
**********/
#include <stdio.h>
int main()
{
int year;
printf("Enter a year: ");
scanf("%d",&year);
if(year%4 == 0)
{
if( year%100 == 0)
{
// HERE IS THE BUG, WHEN YEAR%400 == 0, THEN IT IS LEAP YEAR!!
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;
}