do
`create some coordinates for line a
xa1#=rnd(500)
ya1#=rnd(500)
xa2#=rnd(500)
ya2#=rnd(500)
 
`draw line a
line xa1#,ya1#,xa2#,ya2#
 
`create some coordinates for line b
xb1#=rnd(500)
yb1#=rnd(500)
xb2#=rnd(500)
yb2#=rnd(500)
 
`draw line b
line xb1#,yb1#,xb2#,yb2#
 
`find gradient of line a
ma#=(ya2#-ya1#)/(xa2#-xa1#)
 
`find gradient of line b
mb#=(yb2#-yb1#)/(xb2#-xb1#)
 
`find x coordinate of intersection between lines a and b
xi#=(yb1#-mb#*xb1#-ya1#+ma#*xa1#)/(ma#-mb#)
 
`find y coordinate of intersection between lines a and b
yi#=ma#*xi#+ya1#-ma#*xa1#
 
`draw circle at point of intersection
circle xi#,yi#,10
 
text 0,0,"Press space"
wait key
cls
loop