pvjc23/du3/program.c

55 lines
842 B
C

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <assert.h>
#define VELKOST_POLA 50
int main(){
int a = 0;
char r[SIZE];
memset(r, 0, SIZE);
char* stav_r = fgets(r, SIZE, stdin);
bool x0 = true;
if (stav_r == NULL){
break;
}
if (x0 = true){
x[a] = strtof(r);
}
if (r[0] == '\n'){
x0 = false;
}
if (pipa(r[0])){
if (a < 1 && n > -1){
printf("Nepodarilo sa nacitat zaklad x\n" );
break;
}
printf"Nepodarilo sa nacitat polynom na %d mieste.\n", a);
break;
}
if (x0 = true){
a = a+1;
}
if (a == 2){
printf("Vysledok je: %.2f\n", x[1]);
return 0;
}
long int b;
b = x[0];
long int c;
c = x[1];
long int results = 0;
int d = 0;
while (d < a-2){
d++;
results = b*c+x[d+1];
c = results;
}
printf("Vysledok: %.2f\n", results);
return 0;
}