Computer Science, asked by rajubagh, 6 months ago

write a program to input 3 angle of a triangle and check if a triangle can be formed or not​

Answers

Answered by Yengalthilak12
31

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.

Answered by divyaajay05
1

Answer:

For python programming language you can do the program like this

first_angle = input('Enter the first angle of the triangle ')

second_angle = input('Enter the second angle of the triangle ')

third_angle = input('Enter the third angle of the triangle ')

sum = first_angle + second_angle + third_angle

if sum == 180:

print ("A traingle with following angles are possible")

else:

print ("A traingle with following angles are not possible")

Explanation:

First we take the input of the three angles. Then we will add the three angles and check if the sum of the angles are 180 degree, if the sum is 180 a triangle can be formed else the traingle cannot be formed.

Similar questions