35 lines
709 B
C
35 lines
709 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#define VELKOST_POLA 52
|
|
#define SIZE 52
|
|
|
|
int main(){
|
|
char riadok[SIZE];
|
|
double vxod[999];
|
|
char *endptr = NULL;
|
|
double result = 0;
|
|
int a;
|
|
for(int i = 0; i < SIZE; ){
|
|
char* r = fgets(riadok,SIZE,stdin);
|
|
if(*r != '\n'){
|
|
if(*r >= 65 && *r <= 122){
|
|
if(i == 0){
|
|
printf("Nepodarilo sa nacitat zaklad x\n");
|
|
return 0;
|
|
}else{
|
|
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i);
|
|
return 0;
|
|
}
|
|
}
|
|
double v = strtod(riadok,&endptr);
|
|
vxod[i++] = v;
|
|
a = i;
|
|
}else
|
|
break;
|
|
}
|
|
for(int i = 1; i < a; i++)
|
|
result = vxod[0] * result + vxod[i];
|
|
printf("Vysledok je: %.2f\n", result);
|
|
return 0;
|
|
}
|