Determine the type of triangle
Judging the type of the triangle based on the three edges of the input triangle, and outputting its area.
1#include <stdio.h>2#include <math.h>3 4 voidJudge_1 (DoubleXDoubleYDoublez);5 6 voidMain ()7 {8 DoubleA, B, C;9printf"Input tri-side a B C:");Tenscanf"%lf%lf%lf", &a, &b, &c); One Judge_1 (A, B, c); Aprintf"\ n"); - } - the voidJudge_1 (DoubleXDoubleYDoublez) - { - Doublem, S, area; - if(x>y) + { -m =y; +y =x; Ax =m; at } - if(x>z) - { -m =Z; -z =x; -x =m; in } - if(y>z) to { +m =Z; -z =y; they =m; * } $ Panax Notoginseng if(X+y>z && z-y<x) - { thes = (x+y+z)/2.0; +Area = sqrt (s* (s-x) * (s-y) * (S-z)); A if(x = = y && x==z) the { +printf"equilateral triangle-area is:%lf\n", area); - } $ Else if(x = = y | | y = = Z | | x==z) $ { -printf"isosceles Triangle-area is:%lf\n", area); - } the Else if(x*x + y*y = = z*z) - {Wuyiprintf"Right Triangle-area is:%lf\n", area); the } - Else Wu { -printf"Normal triangle-area:%lf\n", area); About } $ } - Else - { -printf"cannot form a triangle \ n"); A } +}
C Language Learning 9