-
Notifications
You must be signed in to change notification settings - Fork 8
/
dayofprogrammer.c
51 lines (43 loc) · 982 Bytes
/
dayofprogrammer.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
#include<stdio.h>
int main()
{
int year,m,i,da;
int sum[12]={31,59,90,120,151,181,212,243,273,304,334,365};
scanf("%d",&year);
for(i=0;i<12;i++)
{
if((sum[i]-256)>0)
break;
}
m=i+1;
if(year<1918)
{
if(year%4!=0)
da=256-sum[i-1];
else
da=255-sum[i-1];
}
if(year>=1918)
{
if((year%4==0 && year%100!=0)|| year%400==0)
da=255-sum[i-1];
else
da=256-sum[i-1];
}
if(year==1918)
da+=13;
if(m<10)
{
if(da<10)
printf("0%d.0%d.%d",da,m,year);
else
printf("%d.0%d.%d",da,m,year);
}
if(m>10)
{
if(da<10) printf("0%d.%d.%d",da,m,year);
else
printf("%d.%d.%d",da,m,year);
}
return 0;
}