Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
345 B
4
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;
float distance(int x1, int y1, int x2, int y2) {
    int a, b;
    a =  abs(y1 - y2); 
    b = abs(x1 - x2); 
    return  sqrt(a * a + b * b);
               
}
int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << distance(x1, y1, x2, y2);
}
Leave a Comment