-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodemaskBanglaCalander.c
71 lines (55 loc) · 1.15 KB
/
codemaskBanglaCalander.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
#include<stdio.h>
char bangla_month[13][15]={"","Poush", "Magh", "Falgun", "Chaitra",
"Baishakh", "Jaishtha", "Ashar", "Sraban",
"Bhadra", "Ashwin", "Kartik" ,"Agrahayan"
};
int english_month_day[13]={-1,31,28,31,30,31,30,31,31,30,31,30,31};
int bangla_month_day[13]={-1,30,30,30,30,31,31,31,31,31,30,30,30};
int isLeap(int yyyy)
{
if(yyyy%4) return 0;
else{
if(yyyy%100 || yyyy%400==0) return 1;
}
return 0;
}
int main()
{
int T,DD,MM,YYYY;
int tc,totalday,l;
int ansDD,ansMM,ansYYYY;
scanf("%d",&T);
for(tc=1;tc<=T;tc++)
{
scanf("%d%d%d",&DD,&MM,&YYYY);
if(isLeap(YYYY)){
bangla_month_day[3]=31;
english_month_day[2]=29;
}
for(l=1,totalday=DD;l<MM;l++)
{
totalday+=english_month_day[l];
}
ansYYYY=1378+(YYYY-1972);
ansMM=1;
ansDD=17;
for(l=1;l<=totalday;l++)
{
ansDD++;
if(ansDD>bangla_month_day[ansMM]){
ansMM++;
ansDD=1;
if(ansMM==5){
ansYYYY++;
}
else if(ansMM>12){
ansMM=1;
}
}
}
printf("Case %d: %d, %s, %d\n",tc,ansDD,bangla_month[ansMM],ansYYYY);
bangla_month_day[3]=30;
english_month_day[2]=28;
}
return 0;
}