Erster Commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
float x1, x2, y1, y2;
|
||||
float distance;
|
||||
|
||||
printf("Please enter the first point: \n");
|
||||
printf("X1: ");
|
||||
scanf("%f", &x1);
|
||||
printf("Y1: ");
|
||||
scanf("%f", &y1);
|
||||
// scanf("%d %d", &x1, &y1);
|
||||
|
||||
printf("Please enter the second point: \n");
|
||||
printf("X2: ");
|
||||
scanf("%f", &x2);
|
||||
printf("Y2: ");
|
||||
scanf("%f", &y2);
|
||||
|
||||
// scanf("%d %d", &x2, &y2);
|
||||
|
||||
printf("Firts Point P1(%.3f,%.3f)\n", x1, y1);
|
||||
printf("Second Point P2(%.3f,%.3f)\n", x2, y2);
|
||||
|
||||
distance = (float)sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2));
|
||||
|
||||
printf("The distance between P1 and P2 is equal to: %.3f\n", distance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user