3
I need the final result to show the whole number and two boxes after the comma.
It has how to filter, let’s say, this not to show all the decimal places?
#include <stdio.h>
#include <math.h>
int main()
{
float r, resp; // declara variavel
printf("\n Digite o valor do raio: "); // entrada do valor do raio
scanf("%f",&r); // le entrada
resp = pow (r,3); //calcula area
resp = resp * 3.14159; //calcula area
resp = (resp * (4.0 / 3.0)); //calcula area
printf("\n\n VOLUME = %f\n\n ",resp); //exibe resultado em tela
return 0;
}
Example
enter with value 3, it gives as output 113.097237
, but I need you to just leave 113.09
.
ANOTHER PROBLEM I believe is in the statement of variables. I need to enter with the radius value of '1523' and as output should print '14797486501.627' but in fact it prints '14797485056.000'. Any hint of what to change or which variable to use? ja pus long double and it got some results well out of normal.
– AGenaro