Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Xuat ngay tiep theo
- // Khai bao cac ham thu vien neu co
- #include<stdio.h>
- #include<conio.h>
- int kt(int y)
- {
- if(y%400==0 ||(y%4==0&&y%100!=0))
- return 1;
- return 0;
- }
- // kiem tra ngay thang hop le
- int hople(int d,int m,int y)
- {
- if((d>0&&d<32)&&(m>0&&m<13)&&(y>0))
- return 1;
- return 0;
- }
- void main()
- {
- int d,m,y;
- scanf("%d%d%d",&d,&m,&y);
- if(hople(d,m,y)==1)
- {
- switch(m)
- {
- case 2:
- if(kt(y)==1)
- {
- if(d==29)
- {
- printf("1");
- }
- else
- {
- printf("%d",d+1);
- }
- }
- else
- {
- if(d==28)
- {
- printf("1");
- }
- else
- {
- printf("%d",d+1);
- }
- }break;
- case 1: case 3:case 5: case 7:case 8: case 10:case 12:
- if(d==31)
- {
- printf("1");
- }
- else
- {
- printf("%d",d+1);
- }
- break;
- default: if(d==30)
- {
- printf("1");
- }
- else
- {
- printf("%d",d+1);
- }break;
- }
- }
- else
- {
- printf("0");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement