C Language Learning 9

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.