Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int distancia(int x1, int x2, int y1, int y2){
- float d;
- d = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
- return d;
- }
- int main(void) {
- float x1, x2, y1, y2, d;
- printf("Digite o ponto x1: ");
- scanf("%f", &x1);
- printf("Digite o ponto y1: ");
- scanf("%f", &y1);
- printf("Digite o ponto x2: ");
- scanf("%f", &x2);
- printf("Digite o ponto y2: ");
- scanf("%f", &y2);
- d = distancia(x1, x2, y1, y2);
- printf("A distância entre os dois pontos é %.2f", d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement