#include<stdio.h>
#include<math.h>
float dist(int ,int, int, int);
float dist(int x1, int y1, int x2, int y2)
{
float x;
x = sqrt(pow((x1-x2),2)+pow((y1-y2),2));
return x;
}
float area(float, float, float);
float area(float x, float y, float z)
{
float s,w;
s = (x+y+z)/3;
w = s*(s-x)*(s-y)*(s-z);
return sqrt(w);
}
int main(){
int x1, x2, y1, y2, z1, x3, y3;
float p,q,r;
printf("Enter x1 y1 x2 y2 x3 y3\n");
scanf("%d %d %d %d %d %d",&x1, &y1, &x2, &y2, &x3, &y3);
p = dist (x1, y1, x2, y2);
q = dist (x2, y2, x3, y3);
r = dist (x3, y3, x1, y1);
printf("%f",area(p,q,r));
return 0;
}
When I give input (0,0) (0,1) (1,0) it gives this error
-1.#IND00
. If someone could help I would be really obliged. Thanks
What I have tried:
I can't figure out what to do with this.