Function returning incorrect value
I'm having a little trouble with this block of code:
PI is defined at the beginning of the program as 3.14159 using:
float radius_2, volume;
printf( "Radius: " );
scanf( "%f", &radius_2 );
volume = ( 4 / 3 ) * PI * pow( radius_2, 3 );
printf( "Volume = %f\n", volume );
My problem is that this function is returning 25.132721 as as volume instead of the correct value of ~33.49. I've narrowed the problem down to the 'volume = ( 4 / 3 ) * PI * pow( radius_2, 3 );' statement; specifically the '( 4 / 3 )' portion of the statement. It seems to me that it is returning 1.0 as 4 / 3 instead of the actual value - even though volume is declared type float.
Thanks for any help!