Accepted solution

URI 1045 solution

Open original problem
Source code

#include <stdio.h>

int main() {

     double A,B,C,temp;

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

    if(A>0 && B>0 && C>0)

    {

        if(B>A)

        {

            temp=B;

            B=A;

            A=temp;

            if(C>B)

            {

                temp=C;

                C=B;

                B=temp;

                if(B>A)

                {

                    temp=B;

                    B=A;

                    A=temp;

                }

            }

        }

        else if(C>B)

        {

            temp=C;

            C=B;

            B=temp;

            if(B>A)

            {

                temp=B;

                B=A;

                A=temp;

            }

        }

        if(A>=B+C)printf("NAO FORMA TRIANGULO
");

        else if(A*A==B*B+C*C)printf("TRIANGULO RETANGULO
");

       else if(A*A>B*B+C*C)printf("TRIANGULO OBTUSANGULO
");

       else if(A*A<B*B+C*C)printf("TRIANGULO ACUTANGULO
");

        if(A==B && B==C)printf("TRIANGULO EQUILATERO
");

        else if(A==B || B==C || A==C)printf("TRIANGULO ISOSCELES
");

    }

    return 0;

}
Join the discussion

Add your comment