Tuesday, January 7, 2014

Finding the area of the triangle whose 3 sides are given. ....

class trianglearea
{
  public static void main(String args[])
  {
    int a,b,c;
    double s,area;
    a=Integer.parseInt(args[0]);
    b=Integer.parseInt(args[1]);
    c=Integer.parseInt(args[2]);
    s=(a+b+c)/2.0;
    System.out.println(s);
    area=Math.sqrt(s*(s-a)*(s-b)*(s-c));
    System.out.println("Area =" + area);
  }
}


The applied calculation method is shown underneath.



No comments:

Post a Comment