Tuesday, March 18, 2008

computing the volume of a sphere

/* Program for computing the volume of a sphere */

class P4
{
public static void main(String args[])
{
float r=2, volume, pi = 3.14152F;

volume = (4 * pi * r * r * r) / 3 ;
System.out.println("Volume : "+volume);
}
}

No comments: