round fix

This commit is contained in:
Michal Utľák 2024-03-03 22:34:20 +01:00
parent fc8b19653c
commit 8a84024931

View File

@ -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;
}