From 1c7290797d27782008af5b3a32b015f1caaf4fb7 Mon Sep 17 00:00:00 2001 From: Mikita Sidarenka Date: Tue, 5 Apr 2022 11:48:05 +0000 Subject: [PATCH] Add 'du3/program.c' --- du3/program.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 du3/program.c 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