"C Language" "algorithm" determines the triangle type based on three sides, and C language determines the triangle type
1 # include <stdio. h> 2 3 // determine whether a triangle can be formed based on the length of the three sides, which can be composed of 4 5 int main () {6 int a, B, c at the edge length and angle respectively; 7 printf ("Enter the length of the three sides and separate them with commas: \ n"); 8 scanf ("% d, % d, % d", & a, & B, & c); 9 if (a <= 0 | B <= 0 | c <= 0) {10 printf ("enter a positive number"); 11 return 1; 12} 13 if (a> B + c | B> a + c | c> a + B) {14 printf ("cannot form a triangle \ n "); 15 return 1; 16} 17 printf ("by side length:"); 18 if (a = B | a = c | B = c) {19 if (a = B = c) printf ("equi triangle \ n"); 20 else printf ("equi triangle \ n "); 21} else {22 printf ("normal triangle \ n"); 23} 24 printf ("by angle :"); 25 if (a * a = B * B + c * c | B * B = a * a + c * c | c * c = B * B + a *) 26 printf ("right triangle \ n "); 27 else if (a * a> B * B + c * c | B * B> a * a + c * c | c * c> B * B + * a) 28 printf ("It is an acute triangle \ n"); 29 else30 printf ("It is an acute triangle \ n"); 31 return 0; 32}