# C program to find the square of the distance between two points.

Write a program to find the square of the distance between two points. (For a more advanced problem, find the actual distance.
This problem involves using the standard function ‘sqrt’. Use your help system to find out more about how to use this function.)

```/**********************************************************************
* Write a program to find the square of the distance between two
* points. (For a more advanced problem, find the actual distance.
* This problem involves using the standard function 'sqrt'. Use your
* help system to find out more about how to use this function.)
**********************************************************************/

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

char line;             /* a line of keyboard input */
float distance;             /* distance between two points */
float square;               /* the square of the distance */
float square_root;          /* the square root of square */

int main() {
printf("Enter the distance: ");
fgets(line, sizeof(line), stdin);
sscanf(line, "%f", &distance);

square = distance * distance;
printf("Square of distance is %f\n", square);

square_root = sqrtf(square);
printf("Square root of previous result is %f\n", square_root);

return(0);
}
/*

OUTPUT:
Enter the distance: 100
Square of distance is 10000.000000
Square root of previous result is 100.000000

*/
```

# Partner Sites

## SqliteTutorials.com

#### 1 Comment

1. Thanks For Sharing Awesome Article You Website Is Awesome .Here Is A Collection Of Huge Programs & Project Etc.You Also Can Learn C, C++, Java And Blog & Website Designing
http://www.programmingwithbasics.com