hello there
am trying to compute the volume of a cone using a function but it always gives 0, why???
i still an amateur so excuse me
Code:
# include <stdio.h>
# define PIE 3.14
float ComputeVolume ( float r, float h, float ans , float r2 );
int main () {
float radius=0 , height=0 , ans, r2;
printf (" Radius : ");
scanf ("%f", & radius );
printf (" Height : ");
scanf ("%f", & height );
ans = ComputeVolume (radius , height , ans , r2 );
printf (" Volume : %f\n", ans );
system("PAUSE");
return 0;
}
float ComputeVolume ( float r, float h, float ans , float r2)
{
r2 = r*r;
ans = (1/3)* PIE *r2*h;
return ans ;
}
any help?!!!