Wednesday, November 24, 2010

Write a program to determine three given points are collinear or not

implicit double precision (a-h,o-z)
    write(*,*) " enter the points first x coordinate then y coordinate"
    Read (*,*) x1, x2, x3, y1, y2, y3
    s = (x1-x2)*(y2-y3)-(y1-y2)*(x2-x3)
    if(s.EQ.0) then
    write(*,*) "points are collinear"
    else
    write(*,*) "points are not collinear"
    endif
    stop
    end

No comments:

Post a Comment