Изменил(а) на 'du3/program.c'
This commit is contained in:
parent
296065bc0a
commit
01529e3ba9
@ -7,7 +7,7 @@
|
||||
int main(){
|
||||
char pol[SIZE];
|
||||
memset(pol,'\0',SIZE);
|
||||
pol[SIZE]='\0';
|
||||
//pol[SIZE]='\0';
|
||||
|
||||
int ch=0;
|
||||
|
||||
@ -17,37 +17,41 @@ int main(){
|
||||
pol[idx]=ch;
|
||||
}
|
||||
|
||||
int koef=-1;
|
||||
/*for(int i=0; i<strlen(pol);i++){
|
||||
if(pol[i]=='\n')printf("||");
|
||||
else printf("%c",pol[i]);
|
||||
}*/
|
||||
|
||||
|
||||
int koef=-1;
|
||||
for(int i=0;i<strlen(pol);i++){
|
||||
if(pol[i]=='\n')continue;
|
||||
for(int i2=0; pol[i]!='\n';i++);
|
||||
for(int i2=0;pol[i]!='\n';i++,i2++);
|
||||
koef++;
|
||||
}
|
||||
|
||||
float x=0;
|
||||
long double x=0;
|
||||
char *end = NULL;
|
||||
char *start = pol;
|
||||
x=strtof(start,&end);
|
||||
x=round(x*100)/100;
|
||||
|
||||
x=(round(x*100))/100;
|
||||
start=end;
|
||||
|
||||
float num=0;
|
||||
long double num=0;
|
||||
for(int i=0;i<koef;i++){
|
||||
float p=1, n=0;
|
||||
long double p=1, n=0;
|
||||
n=strtof(start,&end);
|
||||
n=round(n*100)/100;
|
||||
start=end;
|
||||
n=(round(n*100))/100;
|
||||
|
||||
for(int idx=(koef-i)-1;idx>0;idx--)p*=x;
|
||||
p=pow(x,(koef-i)-1);
|
||||
|
||||
num+=p*n;
|
||||
}
|
||||
//num=round(num*100)/100;
|
||||
|
||||
num=round(num*100)/100;
|
||||
|
||||
printf("Vysledok je: %.2f\n", num);
|
||||
printf("%.2Lf\n", num);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user