Write a program to enter three angles of a triangle. The program checks whether it forms a triangle(Sum of the angles is 180). If it doesn’t form a triangle, then display a message ”Triangle is not possible”. And if the angles qualify to form a triangle then it checks whether the triangle is a Right angle, Acute angle or Obtuse angle triangle
Answers
Answer:
Computers works on the principle of input , processing and output
.
.
.
.
not sure about this answer
Answer:
import java.io.*;
import java.util.Scanner;
class triangle{
public static void main(String[]args){
Scanner scan = new Scanner(System.in);
float a, b, c, sum;
System.out.println("Enter the first angle of the triangle : ");
a = scan.nextFloat();
System.out.println("Enter the second angle of the triangle : ");
b = scan.nextFloat();
System.out.println("Enter the third angle of the triangle : ");
c = scan.nextFloat();
sum = a+b+c;
if (sum=180)
{
if (a = 90 || b = 90 || c = 90)
{
System.out.println("The triangle is right angled.");
}
else if (a < 90 && b < 90 && c < 90)
{
System.out.println("The triangle is acute.");
}
else if (a > 90 || b > 90 || c > 90)
{
System.out.println("The triangle is obtuse.");
}
}
else {
System.out.println("The triangle is not possible.");
}
}
}