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=(y2-y1)/(1.0*(x2-x1));
cout<<"Slope = "<<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=(y2-y1)/(1.0*(x2-x1));
cout<<"Slope = "<<dist;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment