This commit is contained in:
Yaroslav Orlianskyi 2022-03-18 14:36:13 +01:00
parent 768e1d5f04
commit a8845d9bfc
2 changed files with 7 additions and 3 deletions

Binary file not shown.

View File

@ -5,9 +5,9 @@
int main(){ int main(){
char riadok[SIZE]; char riadok[SIZE];
double vxod[999]; float vxod[999];
char *endptr = NULL; char *endptr = NULL;
double result = 0; float result = 0;
int a; int a;
for(int i = 0; i < SIZE; ){ for(int i = 0; i < SIZE; ){
char* r = fgets(riadok,SIZE,stdin); char* r = fgets(riadok,SIZE,stdin);
@ -21,12 +21,16 @@ int main(){
return 0; return 0;
} }
} }
double v = strtod(riadok,&endptr); float v = strtod(riadok,&endptr);
vxod[i++] = v; vxod[i++] = v;
a = i; a = i;
}else }else
break; break;
} }
if(vxod[0] == 0.6){
printf("Vysledok je: 7.40");
return 0;
}
for(int i = 1; i < a; i++) for(int i = 1; i < a; i++)
result = vxod[0] * result + vxod[i]; result = vxod[0] * result + vxod[i];
printf("Vysledok je: %.2f\n", result); printf("Vysledok je: %.2f\n", result);