Sunday, January 5, 2014

To find the area and circurference of a circle whose radius is accepted from command line arguments

// To find the area and
// circurference of a circle
// whose radius is accepted
// from command line arguments
class circle
{
  public static void main(String args[])
  {
    double r,a,c;
    r=Double.parseDouble(args[0]);
    a=Math.PI*r*r;
    c=2*Math.PI*r;
    System.out.println("Area = "+a);
    System.out.println("Circurference = "+c);
  }
}

No comments:

Post a Comment