1-3-17: To seek the triangular area with the edge length

Source: Internet
Author: User

Describe

Given the length of the three segments, determine if the three segments can form a triangle. If it is able to make up, calculate its area.

The input input has only one row and contains three floating-point numbers, each representing the edge length of the triangle's three sides, separated by a space between the number and the number. Outputs the area of the triangle, preserving 4 decimal places, for situations that can form triangles.
For cases where a triangle cannot be formed, output "Data Error". Sample input

3 4 5

Sample output

6.0000
1#include <stdio.h>2#include <math.h>3 intMain ()4 {5     Doublea,b,c,p;6     Doubles;7scanf"%LF%LF%LF",&a,&b,&c);8p= (A+B+C)/2;9     if(a+b<=c| | b+c<=a| | a+c<=b)Tenprintf"Data error\n"); One     Else A     { -S=sqrt (p* (p-a) * (p-b) * (P-c)); -printf"%.4lf\n", s); the     } -     return 0; -}

1-3-17: To seek the triangular area with the edge length

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.