Initialization

This commit is contained in:
Kozar 2024-03-08 01:11:46 +01:00
parent 1d489bff98
commit a2b7fa9c8e

View File

@ -10,31 +10,29 @@ int main() {
int length = 0; int length = 0;
double result = 0.0; double result = 0.0;
while (count < SIZE) { while (count < SIZE) {
if (scanf("%lf", &input) != 1) { if (scanf("%lf", &input) != 1) {
if (scanf("%c", &input) == 1) { if (count == 0){
if (count == 0){ printf("Nepodarilo sa nacitat zaklad x\n");
printf("Nepodarilo sa nacitat zaklad x\n");
return 0;
}
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count);
return 0; return 0;
} }
break;
}
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count);
return 0;
}
coefs[count] = input; coefs[count] = input;
count++; count++;
if (getchar() == '\n') {
break;
}
} }
x = coefs[0]; x = coefs[0];
length = count; length = count;
while (getchar() != '\n') { 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);