# Input angles and check equilateral, isosceles, or scalene triangle in Java

###### if else if - Question 8

In this question, we will see how to input 3 angles of a triangle and check whether it is an equilateral, isosceles or scalene triangle in Java programming using the if else if statement. To know more about if else if statement click on the if else if statement lesson.

Q8) Write a program in Java to input 3 angles of a triangle and check whether it is an equilateral, isosceles or scalene triangle.

An equilateral triangle is one whose all angles are equal and the sum of all the angles is 180. An isosceles triangle is one whose any two angles are equal and the sum of all the angles is 180. A scalene triangle is one whose none of the angles are equal but sum of all the angles is 180.

#### Program

``````import java.util.Scanner;

public class Q8
{
public static void main(String args[])
{
int a,b,c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter 3 angles of a triangle");
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
if(a+b+c==180)
{
if(a==b && b==c && c==a)
{
System.out.print("Equilateral traingle");
}
else if(a==b || b==c || c==a)
{
System.out.print("Isosceles traingle");
}
else
{
System.out.print("Scalen triangle");
}
}
else
{
System.out.print("Invalid input");
}
}
}``````

#### Output

```Enter 3 angles of a triangle
45
90
45
Isosceles traingle           ```