Initialization

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

View File

@ -12,7 +12,6 @@ int main() {
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; return 0;
@ -21,21 +20,20 @@ int main() {
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count); printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count);
return 0; return 0;
} }
break;
}
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);