This commit is contained in:
Džubara 2024-03-07 22:38:58 +01:00
parent cef61faf0c
commit f9711b5aee

View File

@ -14,6 +14,7 @@ int main() {
char line[MAX_LINE_LENGTH];
double result = 0;
double x;
int lineNumber = 1;
if (fgets(line, MAX_LINE_LENGTH, stdin) == NULL || !IsValidNumber(line)) {
printf("Nepodarilo sa nacitat zaklad x\n");
@ -25,10 +26,11 @@ int main() {
while (fgets(line, MAX_LINE_LENGTH, stdin) != NULL && IsValidNumber(line)) {
double coefficient = strtod(line, NULL);
result = result * x + coefficient;
lineNumber++;
}
if (line[0] != '\n') {
printf("Nepodarilo sa nacitat koeficient polynomu\n");
printf("Nepodarilo sa nacitat polynom na %d mieste\n", lineNumber);
return 1;
}