diff --git a/du3/program.c b/du3/program.c new file mode 100644 index 0000000..854f0c0 --- /dev/null +++ b/du3/program.c @@ -0,0 +1,57 @@ +#include +#include +#include +#include +#include +#include +#define LINE_SIZE 55 +int main(){ + int n; + n=0; + double x[LINE_SIZE]; + while(10==10){ + char riadok[LINE_SIZE]; + memset(riadok, 0,LINE_SIZE); + char* r = fgets(riadok,LINE_SIZE,stdin); + bool x1=true; + + + if (r == NULL){ + break; + } + if (x1=true){ + x[n]=strtof(riadok); + } + if (riadok[0]=='\n'){ + x1=false; + } + if (isalpha(riadok[0])){ + if (n<1 && n>-1){ + printf("Nepodarilo sa nacitat zaklad x\n" ); + break; + } + printf("Nepodarilo sa nacitat polynom na %d mieste.\n", n); + break; + } + if (x1=true){ + n=n+1; + } + } + if (n==2){ + printf("Vysledok je: %.2f\n", x[1]); + return 0; + } + long int a; + a=x[0]; + long int v; + v=x[1]; + long int result=0; + int l=0; + while (l