/*  dist.c: distance between 2 points          */
/*                                             */
/*  This program computes the                  */
/*  distance between two points.               */

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

int main() {
   /*  Declare variables. */
   double x1, y1, x2, y2;
   double a;

   /*  Initialize variables. */
   x1 = 1; y1 = 5; /* point p1 */
   x2 = 4; y2 = 7; /* point p2 */

   /* Print points. */
   printf("Point p1: (%6.4f, %6.4f)\n", x1, y1);
   printf("Point p2: (%6.4f, %6.4f)\n", x2, y2);

   /*  Compute distance. */
   a = sqrt((x2 - x1)*(x2 - x1) +
            (y2 - y1)*(y2 - y1));

   /*  Print distance. */
   printf("Distance between points: %8.4f\n", a);
}


