SOURCE CODE OUTPUT
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int x1,x2,y1,y2;
float dist;
cout<<"Enter coordinates of first point (x1,y1)";
cin>>x1>>y1;
cout<<"Enter coordinates of second point (x2,y2)";
cin>>x2>>y2;
dist=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
cout<<"Distance between two points is "<<dist;
return 0;
}
#include<math.h>
using namespace std;
int main()
{
int x1,x2,y1,y2;
float dist;
cout<<"Enter coordinates of first point (x1,y1)";
cin>>x1>>y1;
cout<<"Enter coordinates of second point (x2,y2)";
cin>>x2>>y2;
dist=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
cout<<"Distance between two points is "<<dist;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment