C. Triangle Area

Source: Internet
Author: User

Enter three numbers on the keyboard, set them to the three sides of the triangle, and then calculate the area.

# Include "stdio. H"
# Include "conio. H"
# Include <math. h>

Main (){
Float a, B, c;
Float area;
Float S;
Scanf ("% F, % F, % F", & A, & B, & C );
If (a + B) <c ){
Printf ("erro ");
} Else if (a-B)> C ){
Printf ("erro ");
} Else {
S = 1.0/2 * (A + B + C );
Area = SQRT (S * (S-A) * (S-B) * (s-c ));
Printf ("% F", area );
}
Getch ();
}

ThisProgramIt took me a long time.

Knowing that SQRT is an open request

However, there are many details to be aware.

First, when the scanf function is called, the input format must be consistent with the defined type. Otherwise, there will be deviations.

In addition, you must import the package math because the SQRT function is called,

Otherwise, what will happen?

 

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.