Изменил(а) на 'du3/program.c'

This commit is contained in:
Andrii Hermaniuk 2022-03-17 22:00:47 +00:00
parent bf0e5f2143
commit 296065bc0a

View File

@ -29,23 +29,23 @@ int main(){
char *end = NULL; char *end = NULL;
char *start = pol; char *start = pol;
x=strtof(start,&end); x=strtof(start,&end);
x=round(x*100)/100;
start=end; start=end;
float num=0; float num=0;
for(int i=0;i<koef;i++){ for(int i=0;i<koef;i++){
float p=1, n=0; float p=1, n=0;
n=strtof(start,&end); n=strtof(start,&end);
if(n)start=end; n=round(n*100)/100;
else break; start=end;
for(int idx=(koef-i)-1;idx>0;idx--)p*=x; for(int idx=(koef-i)-1;idx>0;idx--)p*=x;
num+=p*n; num+=p*n;
} }
num*=100; num=round(num*100)/100;
num=round(num);
num/=100;
printf("Vysledok je: %.2f\n", num); printf("Vysledok je: %.2f\n", num);
return EXIT_SUCCESS; return EXIT_SUCCESS;