Quick actions

cmd+k|ctrl+k

Navigation

Languages

Exercício 2 Tópico 2

Snippet info

Language

C

Visibility

public

Author

brunolaviso

Created

2019-02-14T23:44:19Z

Updated

2019-02-14T23:56:08Z

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

struct pto
{
    float x, y;
};

typedef struct pto ponto;

float calcularDistancia(ponto a, ponto b)
{
    float distancia = pow((b.x-a.x),2) + pow((b.y-a.y),2);
    
    return sqrt(distancia);
}

int main()
{
    ponto a, b;
    a.x = 1;
    a.y = 2;
    b.x = 3;
    b.y = 4;
    
    printf("A distancia euclidiana eh: %.2f", calcularDistancia(a, b));
    
    return 0;
}
INFO