Изменить 'du3/program.c'

This commit is contained in:
Pavlo Tverdyi 2020-03-26 23:05:17 +00:00
parent 7987098918
commit f8ea8afe4f

View File

@ -10,13 +10,15 @@ int day=0;
int m=0; int m=0;
int y=0; int y=0;
sscanf(str, "%d.%d.%d", &day, &m, &y); sscanf(str, "%d.%d.%d", &day, &m, &y);
if(day>29 && m==2 &&(y%400!=0 ||(y%100==0 && y%4!=0))){ if(m==2){
if((y%400==0 ||(y%100!=0 && y%4==0))&&day>29){
printf("Nespravny datum"); printf("Nespravny datum");
return 0; return 0;
} }
if(day>28 && m==2 &&(y%400==0 ||(y%100!=0 && y%4==0))){ else if((y%400!=0 ||(y%100==0 && y%4!=0))&&day>28){
printf("Nespravny datum"); printf("Nespravny datum");
return 0; return 0;
}
} }
day+=7; day+=7;
if(m%2!=0 && day>31){ if(m%2!=0 && day>31){