From 51c7b2684c961344688001b63b92d94d968b6bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=A9re=C5=A1?= Date: Sun, 10 Nov 2019 15:20:30 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/program.c b/program.c index 68540cb..6601e9f 100644 --- a/program.c +++ b/program.c @@ -5,7 +5,7 @@ long long int nsd(long long int,long long int); long long int nsd(long long int cislo1,long long int cislo2){ - while (cislo1 != cislo2){ + /*while (cislo1 != cislo2){ if (cislo1 > cislo2){ cislo1 -= cislo2; } else{ @@ -13,9 +13,13 @@ long long int nsd(long long int cislo1,long long int cislo2){ } } return cislo1; + */ + if (cislo1 == 0) + return cislo2; + return nsd(cislo2 % cislo1, cislo1); } int main() { - //freopen("vstup.txt","r",stdin); + freopen("vstup.txt","r",stdin); char* prvy_vstup = malloc(100* sizeof(char)); char* druhy_vstup = malloc(100* sizeof(char)); long long int prve_cislo;