Im trying to calculate volume of sphere in Xcode where i enter the radius and it gives me the volumes
volume of sphere formula = (4/3)#r³
xcode volume of sphere formula I'm using
i keep getting wrong value for the volume
if i for example enter 5 to radius field I'm getting 392.699096679688 when i should be getting 523.5987756
what am i doing wrong
volume of sphere formula = (4/3)#r³
xcode volume of sphere formula I'm using
Code:
- (IBAction)Sphere:(id)sender
{
float result = (4/3) * 3.141592653589793 * ([_Sphereradius floatValue] * [_Sphereradius floatValue] * [_Sphereradius floatValue]);
[_SphereVolume setFloatValue:result];
}
i keep getting wrong value for the volume
if i for example enter 5 to radius field I'm getting 392.699096679688 when i should be getting 523.5987756
what am i doing wrong