forked from harshitbansal373/hacktoberfest2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday_till_date.c
79 lines (53 loc) · 1016 Bytes
/
day_till_date.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<stdio.h>
double LEAP(int);
int main(){
int day;
int year;
int month;
printf("Enter the month, day, year : ");
scanf("%d%d%d",&month,&day,&year);
double l = LEAP(year);
switch(month-1){
case 11:
day = day+31;
case 10:
day=day+30;
case 9:
day=day+31;
case 8:
day=day+30;
case 7:
day=day+31;
case 6:
day=day+31;
case 5:
day = day + 30;
case 4:
day = day + 31;
case 3:
day= day + 30;
case 2:
day = day + 31;
case 1:
if(LEAP()==1.0){
printf("The year is a leap year.");
day = day + 29 ;
}else {
printf("The year is not a leap year.");
day = day + 28;
}
case 0:
printf("Total days till date are : %d",day);
break;
default:
printf("Invalid input");
}
return (0);
}
double LEAP(int year){
if(((year%4)==0)||(((year%100)==0)&&(year%400)==0)){
return (1.0);
}else {
return (0.0);
}
}