#include <stdio.h>
#include <math.h>

/*

This program decides if a triangle is right-angled, acute or obtus, based on the
input coordinates of the three points.

*/


int main(void)
{

    double x1, y1, x2, y2, x3, y3, d, eps, a, b, c, d12, d23, d31;
    eps=0.00000001;

    /* read in the coordiantes and compute the three sides. */

    printf("input x1:");
    scanf("%lf", &x1);
    printf("input y1:");
    scanf("%lf", &y1);


    printf("input x2:");
    scanf("%lf", &x2);
    printf("input y2:");
    scanf("%lf", &y2);


    printf("input x3:");
    scanf("%lf", &x3);
    printf("input y3:");
    scanf("%lf", &y3);

    d12=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    d23=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    d31=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));


    /* find the largest side, and assign the largest to c, and the other
    two to a and b */

    if (d12>d23)
    {
        c=d12;
        a=d23;
    }
    else
    {
        c=d23;
        a=d12;
    }

    if (c>d31)
    {
        b=d31;
    }
    else
    {
        b=c;
        c=d31;
    }


    /* check how a^2 and b^2+c^2 compare. */

    d=a*a+b*b-c*c;

    if ((d>-eps)&&(d<eps))
    /* d is about 0 */
    {
        printf("It is a right-angled triangle\n");

    }
    else
    {
        if (d>0)
            printf("It is an acute triangle");
        else
            printf("It is a obtuse triangle");

    }


    return 0;

}
