Given the 3 sides of a triangle, find out whether it is acute-angled, right-angled, or obtuse-angled.

You need to output 1 for acute, 2 for right-angled, and 3 for an obtuse-angled triangle. You can assume that the input values always form a triangle and are valid integers.

#### Note:

A triangle is acute-angled, if twice the square of the largest side is less than the sum of squares of all the sides.

A triangle is obtuse-angled, if twice the square of its largest side is greater than the sum of squares of all the sides.

A triangle is right-angled, if twice the square of its largest side is exactly equal to the sum of squares of all the sides.

#### Input:

`3 4 5`

#### Output:

`2`

#### Explanation:

Since 2x5x5 is equal to 5×5 + 3×3 + 4×4, So this is a right-angled triangle and hence, the answer is 2.

#### Input:

`3 3 3`

#### Output:

`1`

#### Explanation:

Since 2x3x3 is less than 3×3 + 3×3 + 3×3, So this is an acute-angled triangle and hence, the answer is 1.

## Solution of which angle triangle : –

```
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
//your code here
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
int y = scanner.nextInt();
int z = scanner.nextInt();
int temp;
if(x>y && x>z)
{
temp=2*x*x;
}
else if(y>x && y>z)
{
temp=2*y*y;
}
else
{
temp=2*z*z;
}
if(temp<(x*x+y*y+z*z))
{
System.out.println("1");
}
else if(temp>(x*x+y*y+z*z))
{
System.out.println("3");
}
else
{
if(temp==(x*x+y*y+z*z))
{
System.out.println("2");
}
}
}
}
```

## Add a Comment