Write a program to enter the three sides of a triangle and find either its an equilateral or scalene or isosceles triangle.
Answers
Answered by
14
import java.util*;
public class Triangle
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
float a,b,c;
System.out.println("Enter the three sides of the triangle");
a= in.nextFloat();
b=in.nextFloat();
c=in.nextFloat();
if(a=b=c)
{
System.out.println("Its an equilateral triangle");
}
elseif(a=b||b=c||c=a)
{
System.out.println("Its an isosceles triangle");
}
else(a!=b!=c)
{
System.out.println("Its a scalene triangle");
}
}
}
Answered by
2
Answer:
the triangle is equilateral. If it is not an equilateral triangle then it may be isosceles. Check if(side1 == side2 || side1 == side3 || side2 == side3) , then triangle is isosceles..
Similar questions
Math,
6 months ago
English,
6 months ago
Social Sciences,
1 year ago
Political Science,
1 year ago
Environmental Sciences,
1 year ago