because 4/3 is an integer division. The result is 1
Change it to e.g. 4.0/3 to get the correct result.
ok no sorry it worls . Thanks :D
I can't see any reason why coder777's suggestion wouldn't work?
what happens if you temporarily do this:
1 2 3 4 5 6 7
|
float getvolcylinder(float radius, float height)
{
return 4.0/3; //*pi*radius*radius*height);
};
|
what is returned? It should be 1.3333334
Last edited on