All pastes #765188 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-07 21:31 UTC
rendered paste body
#include <stdio.h>
#include <math.h>
#include "mikos.h"

double area ( double x1 , double y1, double x2, double y2, double x3, double y3)
{
        double a=length(x1,x2,y1,y2), b=length(x1,x3,y1,y3), c=length(x2,x3,y2,y3) ;
        double t=(a+b+c)/2 ;

        return sqrt( t*(t-a)*(t-b)*(t-c) ) ;
}

int main ()
{
        double x1, x2, x3, y1, y2, y3, A ;

        do {
                printf("give the coordinates of the firsth point of the triange\n");
                scanf("%lf", &x1);
                scanf("%lf", &y1);
                printf("give the coordinates of the second point of it\n");
                scanf("%lf", &x2);
                scanf("%lf", &y2);
                printf("give the coordinates of the final point\n");
                scanf("%lf", &x3);
                scanf("%lf", &y3);

                A=area(x1,x2,x3,y1,y2,y3);

                if ( A>0 ) {
                        printf("the area of the triange is %lf\n", A);
                }
        } while ( A ) ;

        return 0;
}
~