From fb8f0703274ebdbcaa8e8aab3eb8de13254f6b14 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Thu, 23 Mar 2023 18:09:29 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'a1/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- a1/program.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/a1/program.c b/a1/program.c index 409f91d..82bc5c1 100644 --- a/a1/program.c +++ b/a1/program.c @@ -17,6 +17,7 @@ int main() { int cislo = 0; int counter = 0; int che = 0; + int count = 0; while ((r = fgets(znaky, LINE_SIZE, stdin)) != NULL) { if (feof(stdin)) { break; @@ -49,11 +50,21 @@ int main() { if(yyyy < 1900 || yyyy > 2100){ che = 1; } + if(yyyy % 100 != 0 && yyyy % 4 == 0){ + count++; + } + if(yyyy % 400 == 0){ + count++; + } } counter++; zaciatok_cisla = koniec_cisla + 1; } } + if(count != 1 && mm == 2 && dd == 29){ + che = 1; + //printf("Neplatny datum.\n"); + } if(counter != 3 || che == 1){ printf("Neplatny datum.\n"); che = 1;