All pastes #765134 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-07 20:51 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

double length ( double x1, double x2, double y1, double y2)
{
        return sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) );
}

void main ()
{
        double x1, x2, y1, y2, l ;

        do {
                printf("give the coordinates of a point\n") ;
                scanf("%lf", &x1) ;
                scanf("%lf", &y1) ;
                printf("give the coordinates of another point\n") ;
                scanf("%lf", &x2) ;
                scanf("%lf", &y2) ;
                l=length(x1,x2,y1,y2);

                if ( l != 0 ) {
                        printf("the lenght between the first and the second point is %lf\n", length(x1,x2,y1,y2) ) ;
                }
        } while ( l ) ;

        return 0;
}