! This is a basic starting shell for your programs MODULE const INTEGER, PARAMETER :: dp = KIND(1.0d0), sp = KIND(1.0e0) REAL(KIND=dp), PARAMETER :: dpi = 3.141592653589793d0 END MODULE const ! ! Program to find the equation of a line given 2 points ! in the x,y plane PROGRAM prog USE const IMPLICIT NONE REAL(KIND=dp) :: x1,x2,y1,y2,m,b WRITE(*,*) 'Input x1,y1' READ(*,*) x1,y1 WRITE(*,*) 'Input x2,y2' READ(*,*) x2,y2 ! First compute the slope m = (y2-y1)/(x2-x1) ! Get y intercept. y = mx + b, so solve for b and plug one ! of the 2 given points in for x and y. b = y1 - m*x1 WRITE(*,*) 'Slope, y-intercept = ',m,b END PROGRAM prog !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Input x1,y1 ! -2,3 ! Input x2,y2 ! 5,-5 ! Slope, y-intercept = -1.1428571428571428 0.71428571428571441 ! Input x1,y1 ! 1,3 ! Input x2,y2 ! 1,5 ! Slope, y-intercept = Infinity -Infinity