This commit is contained in:
kr820js 2024-03-03 17:40:44 +01:00
parent 871ea05e5c
commit e4429598cc

View File

@ -11,6 +11,7 @@ int main()
float array_of_numbers[SIZE_OF_ARRAY];
int counter=0;
int result;
float pow_result;
while(1){
float x=0;
result=reading_input(&x);
@ -24,11 +25,17 @@ int main()
return 0;
}
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;
}
//ceil(result_of_main * 100) / 100)
int reading_input(float *number){
char buffer[SIZE_OF_ARRAY];
fgets(buffer,SIZE_OF_ARRAY,stdin);
@ -52,3 +59,4 @@ int reading_input(float *number){
*number=atof(buffer);
return 1;
}