This commit is contained in:
Yaroslav Orlianskyi 2022-03-18 14:17:51 +01:00
parent 585be0727b
commit 4eacb196ef

View File

@ -1,26 +1,35 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib>
#define VELKOST_POLA 52
#define SIZE 52
int main(){ int main(){
float vxod[999]; char riadok[SIZE];
int i = 0; double vxod[999];
float result = 0; char *endptr = NULL;
while(1){ double result = 0;
float value = 0; int a = i;
float r = scanf("%f", &value); for(int i = 0; i < size; i++){
if(r == 1) char* r = fgets(buffer,SIZE,stdin);
vxod[i++] = value; if(*r != '\n'){
else if(r <= 255 && r >= 0){ if(*r >= 0 && *r <= 255){
if(i != 0) if(i == 0){
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i); printf("Nepodarilo sa nacitat zaklad x\n");
else return 0;
printf("Nepodarilo sa nacitat zaklad x\n"); }else{
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", i);
return 0;
}
}
double v = strtod(buffer,&endptr);
k[i] = v;
a = i;
}else
break; break;
}else{ }
for(int a = 1; a < i; a++) for(int i = 1; i < a; i++)
result = vxod[0] * result + vxod[a]; result = vxod[0] * result + vxod[i];
printf("Vysledok je: %.2f\n", result); printf("Vysledok je: %.2f\n", result);
break;
}
} }
return 0; return 0;
} }