Answer:
Check the explanation
Explanation:
Points to consider:
We need to take the input from the user
We need to find the manhatan distance and euclidian using the formula
(x1, y1) and (x2, y2) are the two points
Manhattan:
[tex]|x_1 - x_2| + |y_1 - y_2|[/tex]
Euclidian Distance:
[tex]\sqrt{(x1 - yl)^2 + (x2 - y2)^2)}[/tex]
Code
#include<stdio.h>
#include<math.h>
struct Point{
 int x, y;
};
int manhattan(Point A, Point B){
 return abs(A.x - B.x) + abs(A.y- B.y);
}
float euclidean(Point A, Point B){
 return sqrt(pow(A.x - B.x, 2) + pow(A.y - B.y, 2));
}
int main(){
 struct Point A, B;
 printf("Enter x and Y for first point: ");
 int x, y;
 scanf("%d%d", &x, &y);
 A.x = x;
 A.y = y;
 printf("Enter x and Y for second point: ");
 scanf("%d%d", &x, &y);
 B.x = x;
 B.y = y;
 printf("Manhattan Distance: %d\n", manhattan(A, B));
 printf("Euclidian Distance: %f\n", euclidean(A, B));
Â
}
Sample output