From aacaf91247b8116ec3911ae5f8244542acd73652 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 26 Mar 2020 22:20:22 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu3/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/du3/program.c b/du3/program.c index b2d1e90..c5c1e35 100644 --- a/du3/program.c +++ b/du3/program.c @@ -6,7 +6,6 @@ int ValidateTime(int dd , int mm , int yy) { - int res = 0; if(yy>=1900 && yy<=9999) { //check month @@ -14,26 +13,25 @@ int ValidateTime(int dd , int mm , int yy) { //check days if((dd>=1 && dd<=31) && (mm==1 || mm==3 || mm==5 || mm==7 || mm==8 || mm==10 || mm==12)) - res = 1; + return 1; else if((dd>=1 && dd<=30) && (mm==4 || mm==6 || mm==9 || mm==11)) - res = 1; + return 1; else if((dd>=1 && dd<=28) && (mm==2)) - res = 1; + return 1; else if(dd==29 && mm==2 && (yy%400==0 ||(yy%4==0 && yy%100!=0))) - res = 1; + return 1; else - res = 0; + return 0; } else { - res = 0; + return 0; } } else { - res = 0; + return 0; } - retrun res; } int main()