From 08d40d2f1e97b7fa2a81c1ba79feb09468802df8 Mon Sep 17 00:00:00 2001 From: Igor Dzuro Date: Fri, 20 Mar 2020 09:46:43 +0100 Subject: [PATCH] revert --- a1/program | Bin 16664 -> 0 bytes a1/program.c | 78 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 64 insertions(+), 14 deletions(-) delete mode 100755 a1/program diff --git a/a1/program b/a1/program deleted file mode 100755 index d6d3b501b23f1606d19e0adfe1f097e100ec7485..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16664 zcmeHOeQX>@6`%9P@#X8zag)|f0=bk#asY1}Cvj|AlRMkztdX6B)DEdgvN`+C_NDh> z?$%(3B7)pjoQgxLQmLwhfYLvRK&VJaMFI&MhlnD95+T%x5@D(oT>_|1D3MzfAMee) zcivmCf&Kyfvm@QUdB68DZ{N`a78)w5$*+wcHbenoo*pLrW_$sv|FxBRVoQnLHB`nQbauC zOus;JFlD^dUXWU}(bE(dQ>z{3rckf!3a#bz2(@>dDBB^6cJpL6Pj*aasXeBgPs|Da zE|EVw?Eo1Trl^bM$XjL%>sx}zEv1hrSTJR~Pl6rB`JWa}`%!9dxxCa;{7mU~#ja$c zziIETWUM}!NRN)yk2N>dH|^DO8Ld&?H~L52gNOQLNZ7wPwHWgT_#uY!+rO!8d1Za$ z)Q?~P)i+*!`H2nt+izV&-75H@4|QK(f||mRUXA}cg><=c90WlJ;U>Up9Pox^a1-#L zgZ`Rj^e2|l-v;IZc41eC*4i=%Hxd3MQFVe%+WYv zToB$6QgX(bzji?3*cY&UF0&RKW8_k>;5`*W?kK_o_Z_30C> zf6}0;=if5d>d&;+0A8qvTPh60<#OdJ;5{eVj_J+MgRl>5AdwCFWModyUxt`2`i1xr z##wk{p;!dGpzvo)_>9756+T|VzpLD{Q@fms`Sk={IffO z<5F}DD${oY>m&0hnunlj(HTCeLK8TX;k`C9s0Fq@iIKwNh5Uy<)s=ree5@;fH{2J_ z-wVSN+cEVKA^P;mdZdq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zDaP*D~ey z(H_@Q_WYd(40FQkI{XtS3sJPO7L3(e^1xW_gJj2)+h-e_d+{}!JHD0PaIu58cr7D%l2B1EbUivBzM zzuD}0o>@os94C2Ql8<*mfU$7=Ja20zdybRsDILs;1*joL>Lr}*?fsAKt(5yt$rvif v$zd%e9{u1W<#_o0gX4o^hia*eG^y$~n{#fL6>(bYWdCfl(x|c-*jVvT+nsm1 diff --git a/a1/program.c b/a1/program.c index 8efc1e7..07f6041 100644 --- a/a1/program.c +++ b/a1/program.c @@ -1,15 +1,65 @@ -#include +#include +#include -int main(){ -double x ; -double a ; -double b ; -double c ; -scanf("%lf",&x); -scanf("%lf",&a); -scanf("%lf",&b); -scanf("%lf",&c); -double r = (a*(x*x))+(b*x)+c; -printf ("Vysledok je :%.2lf\n",r); - -} +long double power(long double x, int y); + +int main() { + double x; + double coef[100]; + int coefCount = 0; + int retVal; + long double result = 0; + + if ((retVal = scanf("%lf", &x)) <= 0 || retVal == EOF) { + printf("%s\n", "Chyba: Nespravny vstup"); + return 0; + } + + for (int i=0; i<100; i++) { + retVal = scanf("%lf", &coef[coefCount]); + + if (coef[i] == 0) { + break; + } + + if (retVal <= 0 || retVal == EOF) { + break; + } + + coefCount++; + } + + // printf("CoefCount:%d\n", coefCount); + + for (int i=0; i 0) { + result += coef[i] * power(x, pCoef); + } else { + result += coef[i]; + } + + // printf("c:%lf; p:%d; r:%Lf\n", coef[i], pCoef, result); + } + + printf("Vysledok je :%.2Lf\n", result); + + return 0; +} + +long double power(long double x, int y) { + long double result = x; + + if (y == 0) { + return 0; + } else if (y == 1) { + return result; + } + + for (int i=0; i