I need the final result to show the whole number and 2 boxes after the comma.
Can you filter, say so, not to show all 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
I enter with value 3, it outputs 113.097237
, but I need to output only 113.09
.