1043 Triangle

SemiColon
By -
0
URI Online Judge | 1043

Triangle

Read three point floating values (A, B and C) and verify if is possible to make a triangle with them. If it is possible, calculate the perimeter of the triangle and print the message:

Perimetro = XX.X

If it is not possible, calculate the area of the trapezium which basis A and B and C as height, and print the message:

Area = XX.X

Input

The input file has tree floating point numbers.

Output

Print the result with one digit after the decimal point.
Input SampleOutput Sample
6.0 4.0 2.0Area = 10.0
6.0 4.0 2.1Perimetro = 12.1


Solution:

#include<stdio.h>
int main()
{
    float A, B, C, areaTraphisium, perimeterTriangle ;

    scanf("%f %f %f", &A, &B, &C);

    if ((A < (float)(B+C)) && (B < (float)(A+C)) && (C < (float)(B+A)))
    {
        perimeterTriangle = A + B + C;
        printf("Perimetro = %.1f\n",perimeterTriangle);


    }
    else
    {
        areaTraphisium = ((A + B) * C) / 2;
        printf("Area = %.1f\n",areaTraphisium);
    }
    return 0;

}



Tags:

Post a Comment

0Comments

Post a Comment (0)