Write a program in java to calculate area of a triangle
import java.util.*;
import java.lang.*;
class triangle
{
public static void main (String obj [ ])
{
int a, b, c, s, tri ;
Scanner sc=new scanner (system.in);
System.out.println (“Enter the value of a, b, c”);
a=sc nextInt ();
b=sc nextInt ();
c=sc nextInt ();
s=sc nextInt ();
tri = math.sqrt (s*(s-a)*(s-b)*(s-c));
system.out.println (“Area of triangle is=”+tri);
}
}
import java.lang.*;
class triangle
{
public static void main (String obj [ ])
{
int a, b, c, s, tri ;
Scanner sc=new scanner (system.in);
System.out.println (“Enter the value of a, b, c”);
a=sc nextInt ();
b=sc nextInt ();
c=sc nextInt ();
s=sc nextInt ();
tri = math.sqrt (s*(s-a)*(s-b)*(s-c));
system.out.println (“Area of triangle is=”+tri);
}
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment