#include<stdio.h>
#include<math.h>
float distance(float a,float b,float c,float d);
int main()
{
float x1,y1,x2,y2,dist;
printf("Input x1: ");
scanf("%f", &x1);
printf("Input y1: ");
scanf("%f", &y1);
printf("Input x2: ");
scanf("%f", &x2);
printf("Input y2: ");
scanf("%f", &y2);
distance(x1,x2,y1,y2);
printf("Distance between the given points is: %.2f",sqrt(dist));
return 0;
}
float distance(float a,float b,float c,float d)
{
float x1,x2,y1,y2,dist;
dist=((x2-x1)*(x2-x1) +(y2-y1)*(y2-y1));
return dist;
}
Here the output is always 0, don't know why. I have tried putting float and integers still getting 0.
IGNORE THIS PART OF QUESTION. WRITING THIS TO SATISFY THE CRITERIA TO POST.