Initialization

This commit is contained in:
Kozar 2024-03-04 20:10:29 +01:00
parent bff9910943
commit c7ef54ba95

View File

@ -1,5 +1,4 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define SIZE 100 #define SIZE 100
@ -11,19 +10,7 @@ int main() {
int length = 0; int length = 0;
double result = 0.0; double result = 0.0;
while (count < SIZE) while (count < SIZE && scanf("%lf", &input) == 1) {
{
if (coefs[count] == '\n')
{
return;
}
else if (scanf("%d", &input) != 1)
{
printf("Nepodarilo sa nacitat polynom na %d mieste.", count);
break;
}
coefs[count] = input; coefs[count] = input;
count++; count++;
} }
@ -32,14 +19,11 @@ int main() {
length = count; length = count;
for (int i = 1; i < length; i ++) for (int i = 1; i < length; i ++){
{ result = result * x + coefs[i];
result = result * x + coefs[i];
} }
printf("Vysledok je: %.2lf\n", result); printf("Vysledok je: %.2lf\n", result);
return 0; return 0;
} }