submit14
This commit is contained in:
parent
c2e2132317
commit
0fa3a58d5c
@ -32,20 +32,19 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(int j=1; j<counter; j++){
|
for(int j=1; j<counter; j++){
|
||||||
//double rawPow = pow(array_of_numbers[0],(counter-j)-1);
|
|
||||||
//double roundedPos = round(rawPow*100)/100;
|
|
||||||
double true_power=powering(array_of_numbers[0],(counter-j)-1);
|
double true_power=powering(array_of_numbers[0],(counter-j)-1);
|
||||||
// printf("RAW: %f, ROUNDED: %f, true %f\n", rawPow, roundedPos,true_power);
|
|
||||||
|
|
||||||
result_of_main += array_of_numbers[j]*true_power;
|
result_of_main += array_of_numbers[j]*true_power;
|
||||||
}
|
}
|
||||||
printf("Vysledok je: %.2f\n",round(result_of_main * 100) / 100);
|
printf("Vysledok je: %.2f\n",round(result_of_main * 100) / 100);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//ceil(result_of_main * 100) / 100)
|
|
||||||
int reading_input(double *number){
|
int reading_input(double *number){
|
||||||
char buffer[SIZE_OF_ARRAY];
|
char buffer[SIZE_OF_ARRAY];
|
||||||
fgets(buffer,SIZE_OF_ARRAY,stdin);
|
char *fgets_result = fgets(buffer,SIZE_OF_ARRAY,stdin);
|
||||||
|
if(fgets_result==NULL){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
for(int j=0; buffer[j]!='\0'; j++){
|
for(int j=0; buffer[j]!='\0'; j++){
|
||||||
if (buffer[j]>='0'&&buffer[j]<='9') {
|
if (buffer[j]>='0'&&buffer[j]<='9') {
|
||||||
continue;
|
continue;
|
||||||
@ -57,6 +56,7 @@ int reading_input(double *number){
|
|||||||
buffer[j]='\0';
|
buffer[j]='\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(buffer[0]=='\0'){
|
if(buffer[0]=='\0'){
|
||||||
|
Loading…
Reference in New Issue
Block a user