Write a program to input three angles of a triangle and check whether its
construction is possible or not. If possible then check and display whether it is
an acute-angled triangle ,right-angled or an obtuse-angled triangle. Otherwise,
display ‘ A Triangle is not possible ’.
Answers
Answer:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a1, a2, a3,r
cout<<"Enter first angle of triangle";
cin>>a1;
cout<<"Enter second angle of triangle";
cin>>a2;
cout<<"Enter third angle of triangle";
cin>>a3;
r=a1+a2+a3;
if(r!=180)
{
cout<<"A triangle is not possible";
}
else
{
if(r<90)
{
cout<<"Acute angled Triangle";
}
if(r>90)
{
cout<<"Obtuse angled Triangle";
}
if(r==90)
{
cout<<"Right angled Triangle";
}
getch();
}
Answer:
import java.util.Scanner;
class Triangle
{
public static void main (String args[])
{
Scanner SC = new Scanner(System.in);
System.out.println("The three angles of the triangle.");
float angle1 = SC.nextFloat();
float angle2 = SC.nextFloat();
float angle3 = SC.nextFloat();
if (angle1+angle2+angle3==180)
{System.out.println("This triangle is possible");
}
else
{System.out.println("This triangle is not possible");
}
if (angle1==90|| angle2==90|| angle3==90)
{System.out.println("Right angle triangle");
}
else if (angle1<90&& angle2<90&& angle3<90)
{System.out.println("Triangle is acute");
}
else
{
System.out.println("Triangle is obtuse");}
}
}
Explanation:
This is the answer. Plz Brainliest me