From 8a840249318ea8c8ce187a609c24eb437592d2cf Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Sun, 3 Mar 2024 22:34:20 +0100 Subject: [PATCH] round fix --- cv3/program.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 56484d2..f7f52a4 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -13,15 +13,13 @@ int main() { opakovania++; } - float result = pole[1]; + float vysledok = pole[1]; for (int i = 2; i < opakovania; ++i) { - result = result * pole[0] + pole[i]; + vysledok = vysledok * pole[0] + pole[i]; } - result = ((int)(result * 100 + 0.5)) / 100.0; - - printf("Vysledok je: %.2f\n", result); + printf("Vysledok je: %.2f\n", vysledok); return 0; }