write a java program to enter the perimeter of an equilateral triangle and find its side and area
Answers
Answered by
4
import java.util.*;
public class Side_Area
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int p,s,a;
System.out.println("Enter the perimeter of the triangle");
p=in.nextInt();
s=p/3;
a=Math.sqrt(3*s*s/4);
System.out.println("The side is"+s);
System.out.println("The area is"+a);
}
}
Answered by
6
Import java.util.*;
public class Area
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
double m,n,o;
System.out.println("Enter the perimeter of the triangle");
m=in.nextDouble();
n=m/3;
o=Math.sqrt(3)*(n*n)/4;
System.out.println("Display the side"+n);
System.out.println("Display the area"+o);
}
}
Similar questions
Social Sciences,
7 months ago
Hindi,
7 months ago
Physics,
1 year ago
Accountancy,
1 year ago
Math,
1 year ago
English,
1 year ago