Write a program for finding the equation of a Line Given Two End Points (x1, y1) and (x2, y2) The equation for a line is Y = MX + C Where M = Slope of a Line and C = Intercept To Find the slope of a line slope = (y2 - y1)/(x2-x1) To Find the intercept of the line, intercept = y1 - (slope) * x1 which would be same as, intercept = y2 - (slope) * x2 Sample Output: Program to find the equation of a line given two endpoints:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

Swift Programming language 

100
ilıl
IIII
1= = =
111
EE X
12. 3 11 456
E
Problem No. 3: Read Between the Lines
Write a program for finding the equation of a
Line Given Two End Points (x1,y1) and (x2, y2)
The equation for a line is Y = MX + C
Where M = Slope of a Line and C = Intercept
To Find the slope of a line
slope = (y2 - y1)/(x2-x1)
To Find the intercept of the line, intercept = y1 -
(slope) * x1
which would be same as, intercept = y2 -
(slope) * x2
Sample Output:
Program to find the equation of a line given two
endpoints:
Enter X1: 2
Enter Y1:3
Enter X2: 5
Enter Y2: 7
Equation of the line with endpoints (2, 3 and (5,
7): Y = 1.33333X +0.333333
71
Transcribed Image Text:100 ilıl IIII 1= = = 111 EE X 12. 3 11 456 E Problem No. 3: Read Between the Lines Write a program for finding the equation of a Line Given Two End Points (x1,y1) and (x2, y2) The equation for a line is Y = MX + C Where M = Slope of a Line and C = Intercept To Find the slope of a line slope = (y2 - y1)/(x2-x1) To Find the intercept of the line, intercept = y1 - (slope) * x1 which would be same as, intercept = y2 - (slope) * x2 Sample Output: Program to find the equation of a line given two endpoints: Enter X1: 2 Enter Y1:3 Enter X2: 5 Enter Y2: 7 Equation of the line with endpoints (2, 3 and (5, 7): Y = 1.33333X +0.333333 71
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L