Solve of URI 1015 (Distance Between Two Points) in C & C++
Problem Description of URI Online Judge 1015:
Problem number: 1015.
Problem name: Distance Between Two Points.
Problem level: 1
Problem category: Beginner
Points: 1.9 Points.
Base time limit: 1 Second.
Memory limit: 200 MB.
Problem subject: Sequential.
Problem adapted by: Neilor Tunin (Brazil).
Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1015
Solution language: C & C++
My profile: https://www.urionlinejudge.com.br/judge/en/profile/38770
Solution of URI 1015 in C:
//URI online judge 1015 solution in C
//This solution is made and uploaded by Mehedi Hasan Kajol
#include<stdio.h>
#include<math.h>
int main(void){
double x1, y1, x2, y2, x, y, distance;
scanf(" %lf %lf %lf %lf ", &x1, &y1, &x2, &y2);
x = x2 - x1;
y = y2 - y1;
distance = sqrt( (x * x) + (y * y) );
printf("%.4lf\n", distance);
return 0;
}
Solution of URI 1015 in C++:
//URI online judge 1015 solution in C++
//This solution is made and uploaded by Mehedi Hasan Kajol
#include<iostream>
#include<math.h>
using namespace std;
int main(void){
double x1, y1, x2, y2, x, y, distance;
cin >> x1 >> y1>> x2 >> y2;
x = x2 - x1;
y = y2 - y1;
distance = sqrt( (x * x) + (y * y) );
printf("%.4lf\n", distance);
return 0;
}