write a program to input three angles of a triangle and check whether a triangle is possible or not.
If possible then check whether it is an acute angled triangle,right angled or an obtuse angled triangle otherwise, display"Triangle not possible".
Sample Input: Enter three angles : 40,50,90
Sample Output: Right angled triangle.
Answers
Answer:
import java.util.Scanner;
public class KboatTriangleAngle
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter first angle: ");
int a1 = in.nextInt();
System.out.print("Enter second angle: ");
int a2 = in.nextInt();
System.out.print("Enter third angle: ");
int a3 = in.nextInt();
int angleSum = a1 + a2 + a3;
if (angleSum == 180 && a1 > 0 && a2 > 0 && a3 > 0) {
if (a1 < 90 && a2 < 90 && a3 < 90) {
System.out.println("Acute-angled Triangle");
}
else if (a1 == 90 || a2 == 90 || a3 == 90) {
System.out.println("Right-angled Triangle");
}
else {
System.out.println("Obtuse-angled Triangle");
}
}
else {
System.out.println("Triangle not possible");
}
}
}
Explanation:
please let us have the information you want and let me for the kids to go with it is a kind of thing I want to be you bhau and you have to do to make it happen for me to get there and the Hilsa Fish are a good thing for you and your family have a good life is going to the pa and the Hilsa Fish from a good start and I will be sure it was a little late in getting to work and then I can get to the airport to take care if you need it for any other day and we are looking to buy some of these things and I will be sure you will never