write a java program to calculate the perimeter of an equilateral triangle takin side 4.5 and perimeter 3 × side
Answers
Answered by
1
Answer:
Perimter=sum of all lengths of sides of triangle
⇒ Perimeter =3a {a= side of triangle }
⇒45=3a
⇒a=15cm.
Answered by
1
Question:-
➡ Write a java program to calculate the perimeter of an equilateral triangle takin side 4.5 and perimeter 3 × side.
Program:-
This is written in Java.
class Program
{
public static void main(String args[])
{
double s, p;
s=4.5;
p=3*s;
System.out.println("Perimeter of the triangle is: "+p);
}
}
Variable Description:-
- s - Used for storing the length of each side of triangle.
- p - For calculating the perimeter of the Triangle (p=3s)
Similar questions