write a program to input angles of a triangle and check whether it's a triangle or not
Answers
Answered by
2
Answer:
Logic to check triangle validity if angles are given
Input all three angles of triangle in some variable say angle1 , angle2 and angle3 . Find sum of all three angles, store sum in some variable say sum = angle1 + angle2 + angle3 . Check if(sum == 180) then, triangle can be formed otherwise not.
Explanation:
hello
Answered by
5
Answer:
import java.io.*;
class Triangle
{
public static void main()
{
int a=30,b=60,c=60;
if(a+b+c=180)
System.out.println("Triangle");
else
System.out.println("Not a triangle");
}
}
}
Similar questions