Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday, 13 November 2016

URI-1043

URI Online Judge | 1043

Triangle

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
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


Solutin...

#include <stdio.h>
int main()
{
    double a,b,c;
    scanf("%lf %lf %lf",&a,&b,&c);
    if (a < b + c && b < a + c && c < a + b){
        printf("Perimetro = %.1f\n", a + b + c);
    }
    else{
        printf("Area = %.1f\n", c * (a + b) / 2);
    }
    return 0;
}


No comments:

Post a Comment