Question:
Write a program to input there angles of triangle and check wherether it's contruction posible or not if possible then check and display wheather it's right angle triangle or acute angle or an obtuse angled triangle . Otherwise display 'A triangle is not possible'
Answers
✨____________________________✨
import java.util.*;
public class Triangle
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a.2.a3;
System.out.println("Enter the three angles: ");
a1=sc.nextInt();
a2=sc.nextInt;
a3=sc.nextInt();
if(a1+a2+a3==180)
{
System.out.println("Triangle is possible");
if(al<90 && a2<90 && a3<90)
System.out.println("Acute-angled triangle");
if(al=90 || a2=90 || a3==90)
System.out.println("Right-angledtriangle");
if(al>90 | a2>90 || a3>90)
System.out.println("Obtuse-angled triangle");
}
else
System.out.println("Triangle not possible");
}
}
program written using java language
explanation:
Sample input:
Enter three angles 40, 90, 50
sample output:
Right Angled triangle
✨____________________________✨
By: Itz Nobody^_^
Answer:
import java.util.*;
class file
{
public static void main (String[] args)
{
Scanner sc= new Scanner(System.in);
int a1,a2,a3;
System.out.println("Enter the 1st angle_");
a1= sc.nextInt();
System.out.println("Enter the 2nd angle_");
a2=sc.nextInt();
System.out.println("Enter the 3rd angle_");
a3=sc.nextInt();
if(a1+a2+a3==180)
{
System.out.println("Triangle is possible ");
if(a1==90||a2==90||a3==90)
System.out.println("Right angled triangle");
if(a1<90 && a2<90 && a3<90)
System.out.println("Acute angled triangle");
if(a1>90||a2>90||a3>90)
System.out.println("Obtuse angled triangle");
}
else
System.out.println("TRIANGLE IS NOT POSSIBLE");
}