submit9
This commit is contained in:
parent
871ea05e5c
commit
e4429598cc
@ -11,6 +11,7 @@ int main()
|
|||||||
float array_of_numbers[SIZE_OF_ARRAY];
|
float array_of_numbers[SIZE_OF_ARRAY];
|
||||||
int counter=0;
|
int counter=0;
|
||||||
int result;
|
int result;
|
||||||
|
float pow_result;
|
||||||
while(1){
|
while(1){
|
||||||
float x=0;
|
float x=0;
|
||||||
result=reading_input(&x);
|
result=reading_input(&x);
|
||||||
@ -24,11 +25,17 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(int j=1; j<counter; j++){
|
for(int j=1; j<counter; j++){
|
||||||
result_of_main=result_of_main+array_of_numbers[j]*pow(array_of_numbers[0],(counter-j)-1);
|
float rawPow = pow(array_of_numbers[0],(counter-j)-1);
|
||||||
|
float roundedPos = round(rawPow*100)/100;
|
||||||
|
//printf("RAW: %f, ROUNDED: %f\n", rawPow, roundedPos);
|
||||||
|
|
||||||
|
result_of_main += array_of_numbers[j]*rawPow;
|
||||||
}
|
}
|
||||||
printf("Vysledok je: %.2f\n",ceil(result_of_main * 100) / 100);
|
|
||||||
|
printf("%f Vysledok je: %.2f\n",result_of_main,round(result_of_main * 100) / 100);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//ceil(result_of_main * 100) / 100)
|
||||||
int reading_input(float *number){
|
int reading_input(float *number){
|
||||||
char buffer[SIZE_OF_ARRAY];
|
char buffer[SIZE_OF_ARRAY];
|
||||||
fgets(buffer,SIZE_OF_ARRAY,stdin);
|
fgets(buffer,SIZE_OF_ARRAY,stdin);
|
||||||
@ -52,3 +59,4 @@ int reading_input(float *number){
|
|||||||
*number=atof(buffer);
|
*number=atof(buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user