#include #include #include #include #define LENGTH 256 int main(){ char line[LENGTH]; char *y, *chcf; int cfIdx, cf1, y1,x1,chcf1 = 0; double x, cf,result = 0; fgets(line, 100, stdin); y = strtok(line,"\n"); x = strtod(line, NULL); y1 = *y; if(y1 >= 'A' && line[0] != '\n'){ printf("Nepodarilo sa nacitat zaklad x\n"); return 1; } while(line[0] != '\n'){ cfIdx++; result = result * x + cf; fgets(line, 100, stdin); chcf = strtok(line,"\n"); cf = strtod(line,NULL); chcf1 = *chcf; if(chcf1 >='A' && line[0] != '\n'){ printf("Nepodarilo sa nacitat polynom na %d mieste.\n", cfIdx); return 1; } } printf("Vysledok je: %.2f\n", result); return 0; }