From 9a061c88423fb591d1093da19eca3e6d2d704399 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 26 Mar 2020 23:11:24 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du3/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/du3/program.c b/du3/program.c index 731ad83..fa93ac3 100644 --- a/du3/program.c +++ b/du3/program.c @@ -10,15 +10,18 @@ int day=0; int m=0; int y=0; sscanf(str, "%d.%d.%d", &day, &m, &y); +if(y%400==0 ||(y%100!=0 && y%4==0)){ + z++; +} if(m==2){ - if((y%400==0 ||(y%100!=0 && y%4==0))&&day>29){ + if(z==1 &&day>29){ printf("Nespravny datum"); return 0; } -// else if((y%400!=0 ||(y%100==0 && y%4!=0))&&day>28){ -// printf("Nespravny datum"); -// return 0; -// } + if(z==0 &&day>28){ + printf("Nespravny datum"); + return 0; + } } day+=7; if(m%2!=0 && day>31){