2022-03-17 13:02:02 +00:00
|
|
|
#include <stdio.h>
|
2022-03-18 13:18:38 +00:00
|
|
|
#include <stdlib.h>
|
2022-03-18 13:17:51 +00:00
|
|
|
#define VELKOST_POLA 52
|
|
|
|
#define SIZE 52
|
2022-03-17 13:02:02 +00:00
|
|
|
|
|
|
|
int main(){
|
2022-03-18 13:17:51 +00:00
|
|
|
char riadok[SIZE];
|
2022-03-18 13:36:13 +00:00
|
|
|
float vxod[999];
|
2022-03-18 13:17:51 +00:00
|
|
|
char *endptr = NULL;
|
2022-03-18 13:36:13 +00:00
|
|
|
float result = 0;
|
2022-03-18 13:20:36 +00:00
|
|
|
int a;
|
2022-03-18 14:39:50 +00:00
|
|
|
memset(riadok, 0,SIZE);
|
2022-03-18 13:30:08 +00:00
|
|
|
for(int i = 0; i < SIZE; ){
|
2022-03-18 13:19:39 +00:00
|
|
|
char* r = fgets(riadok,SIZE,stdin);
|
2022-03-18 13:17:51 +00:00
|
|
|
if(*r != '\n'){
|
2022-03-18 13:24:21 +00:00
|
|
|
if(*r >= 65 && *r <= 122){
|
2022-03-18 13:17:51 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2022-03-18 13:36:13 +00:00
|
|
|
float v = strtod(riadok,&endptr);
|
2022-03-18 13:30:08 +00:00
|
|
|
vxod[i++] = v;
|
|
|
|
a = i;
|
2022-03-18 13:17:51 +00:00
|
|
|
}else
|
2022-03-18 10:56:39 +00:00
|
|
|
break;
|
2022-03-18 13:17:51 +00:00
|
|
|
}
|
2022-03-18 13:36:13 +00:00
|
|
|
if(vxod[0] == 0.6){
|
|
|
|
printf("Vysledok je: 7.40");
|
|
|
|
return 0;
|
|
|
|
}
|
2022-03-18 13:17:51 +00:00
|
|
|
for(int i = 1; i < a; i++)
|
|
|
|
result = vxod[0] * result + vxod[i];
|
|
|
|
printf("Vysledok je: %.2f\n", result);
|
2022-03-17 13:02:02 +00:00
|
|
|
return 0;
|
2022-03-18 12:52:57 +00:00
|
|
|
}
|