final vv
This commit is contained in:
parent
5e3acfa758
commit
5afeadc9cb
@ -9,7 +9,8 @@ int main()
|
|||||||
scanf("%d.%d.%d", &d, &m, &y);
|
scanf("%d.%d.%d", &d, &m, &y);
|
||||||
|
|
||||||
//check date validness
|
//check date validness
|
||||||
if(!(y>=0 && y<=9999) || !(m>=1 && m<=12) || !((d>=1 && d<=31) && (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)) || !((d>=1 && d<=30) && m==4 || m==6 || m==9 || m==11) || !((d>=1 && d<=28) && m==2) || !(d==29 && m==2 && (y%400==0 ||(y%4==0 && y%100!=0)))){
|
if((y>=0 && y<=9999) && (m>=1 && m<=12) && (((d>=1 && d<=31) && (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)) || ((d>=1 && d<=30) && m==4 || m==6 || m==9 || m==11) || ((d>=1 && d<=28) && m==2) || (d==29 && m==2 && (y%400==0 ||(y%4==0 && y%100!=0))))){
|
||||||
|
}else{
|
||||||
puts("Nespravny datum\n");
|
puts("Nespravny datum\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user