All pastes #51658 Raw Edit

Stuff

public text v1 · immutable
#51658 ·published 2006-04-27 05:04 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

char psuba[50];
char psubb[50];
int x1;
int y1;
int x2;
int y2;
int dist;

int main()
{
printf("Enter a pair of points, as in:  x,y .\n");
fgets(psuba,sizeof(psuba),stdin);
sscanf(psuba,"%d,%d",&x1,&y1);

printf("Now do it again.\n");
fgets(psubb,sizeof(psubb),stdin);
sscanf(psubb,"%d,%d",&x2,&y2);

dist = ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1));
dist = sqrt(dist);//

printf("The square of the distance is %d .\n",dist);

return (0);
}