# Answer to Question #43223 in C for Susanta Biswas

Question #43223

Another non recursive functions COMPLETE_LINE that will accept as input parameters the co-ordinates of two end point of straight line as has been read in by the functions READ_POINT,and then complete & returns the length of that line.

Expert's answer

#include<stdio.h>

#include<math.h>

double COMPLETE_LINE( double x1, double y1, double x2, double y2 ){

return pow((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1), 0.5);

}

int main(){

// example for end points (0,0) and (3,4)

printf("%lf", COMPLETE_LINE(0, 0, 3, 4));

return 0;

}

#include<math.h>

double COMPLETE_LINE( double x1, double y1, double x2, double y2 ){

return pow((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1), 0.5);

}

int main(){

// example for end points (0,0) and (3,4)

printf("%lf", COMPLETE_LINE(0, 0, 3, 4));

return 0;

}

``

## Comments

## Leave a comment