c distance in the cartesian plane

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

struct Point {
    float x;
    float y;
};

float calculateDistance(struct Point p1, struct Point p2) {
    return sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
}

int main() {
    struct Point point1, point2;

    printf("Enter coordinates of point 1 (x y): ");
    scanf("%f %f", &point1.x, &point1.y);

    printf("Enter coordinates of point 2 (x y): ");
    scanf("%f %f", &point2.x, &point2.y);

    float distance = calculateDistance(point1, point2);
    printf("Distance between point 1 and point 2: %.2f\n", distance);

    return 0;
}

This C program calculates the distance between two points in the Cartesian plane using the distance formula. It defines a Point structure to store the x and y coordinates of a point. The calculateDistance function takes two Point structures as parameters and calculates the distance between them using the distance formula: √((x2 - x1)^2 + (y2 - y1)^2). The main function prompts the user to enter the coordinates of two points, calls the calculateDistance function, and then displays the calculated distance between the points.