c++ program to find slope of a graph:
#include <iostream>using namespace std;
int main()
{
float x1,x2,y1,y2;
double slope;
cout<<" Enter value of x1 = \n";
cin>>x1;
cout<<"Enter value of x2 = \n";
cin>>x2;
cout<<"Enter value of y1 = \n";
cin>>y1;
cout<<"Enter value of y2 = \n";
cin>>y2;
{
slope=(y2-y1)/(x2-x1);
cout<<"The slope is = "<<slope;
}
return 0;
}
No comments:
Post a Comment