Write a program in JAVA to enter 3 sides of a triangle and find whether the triangle is an equable triangle or not .
(A triangle is said to be equable if the area and perimeter of a triangle is equal .)
Make use of user defined functions to compute area and perimeter and return it .
YOU ARE REQUESTED NOT TO ENTER SILLY ANSWERS IF YOU DONT KNOW THE CORRECT ANSWER
Answers
Answered by
21
public class Triangle
{
public static void main(String args[])
{
double s1, s2, s3, s4, area;
Scanner s = new Scanner(System.in);
System.out.print("Enter the first side :");
s1 = s.nextDouble();
System.out.print("Enter the second side :");
s2 = s.nextDouble();
System.out.print("Enter the third side :");
s3 = s.nextDouble();
s4 = (s1 + s2 + s3 )/ 2 ;
area = Math.sqrt(s4 * (s4 - s1) * (s4 - s2) * (s4 - s3));
System.out.print("Area of Triangle is:"+area+" sq units");
}
}
akshisaha06:
No , it is not the correct answer .
Answered by
58
Please check the image
I am 100% sure it is correct answer.
I am 100% sure it is correct answer.
Attachments:
Similar questions