![]() ![]() So 30 is not equal to 50, so Triangle can’t be formed with length of sides as 10, 50 and 20. There are three types of triangle based on the length of its sides: Equilateral triangle: All sides are equal in length. So the sum of other two sides must be greater than 50. Note: Result of output 4 gives “Invalid Triangle” because – the largest side is 50. Output 4: Enter values for a, b and c 10 50 20 Invalid Triangle Output 3: Enter values for a, b and c 10 50 50 It’s an Isosceles Triangle Output 2: Enter values for a, b and c 30 30 30 It’s an Equilateral Triangle Output 1: Enter values for a, b and c 4 5 6 It’s a Scalene Triangle C Program To Check whether a Triangle is Equilateral, Isosceles or Scalene: Valid Triangle #include You can find the logic to it at Triangle Valid or Not based On Sides: C Program. We’ll need to write the C program to check if the entered values form a valid Triangle or not. YouTube Link: įirst we ask the user to input lengths of 3 sides of the Triangle. ![]() If above two conditions are false, then length of all sides of the Triangle is different or not equal, so it’s a Scalene Triangle.Ĭ Program To Check whether a Triangle is Equilateral, Isosceles or Scalene If any of these conditions are true, then 2 sides of the Triangle are equal. Next, if the first condition is false – we check if either length of a is equal to length of b or length of a is equal to length of c or length of b is equal to length of c. If that’s true, then its Equilateral Triangle. First we check if length of a is equal to length of b and length of c. Scalene: For a triangle to be an Scalene, none of the sides can be congruent. The base can vary, but cannot equal the leg sides. Isosceles: For a triangle to be an Isosceles, the two leg sides must be congruent. Here a, b and c are lengths of sides of the triangle. Note the definition of each triangle: Equilateral: For a triangle to be an Equilateral, all sides must have the same measurements. Output 3: Enter values for a, b and c 10 15 8 It’s a Scalene Triangle Output 2: Enter values for a, b and c 20 20 30 It’s an Isosceles Triangle When all the three sides of the triangle are of different measures, it is a scalene triangle. When any two sides of the triangle are equal in length, it is an isosceles triangle. Output 1: Enter values for a, b and c 10 10 10 It’s an Equilateral Triangle Equilateral Triangle: Isosceles Triangle: Scalene Triangle: When all the three sides of the triangles are equal in length, it is an equilateral triangle. Note: Did you know that there are different kinds of triangles Knowing how to identify these triangles is an important part of solving many problems. Printf("It's an Equilateral Triangle\n") Isosceles Isosceles triangles have 2 equal sides and 2 equal angles. C Program To Check whether a Triangle is Equilateral, Isosceles or Scalene: Valid TriangleĬ Program To Check whether a Triangle is Equilateral, Isosceles or Scalene #include Equilateral Equilateral triangles have 3 equal sides and 3 equal angles of 60° 2.C Program To Check whether a Triangle is Equilateral, Isosceles or Scalene. ![]()
0 Comments
Leave a Reply. |