Small Basic: cálculo del punto medio de una recta, dadas sus coordenas

pmedio1

Escribir un programa en Small Basic, que calcule el punto medio de cualquier recta, dadas sus coordenas. La manera de obtener geométricamente el punto medio de una recta es Dado un segmento, cuyos extremos tienen por coordenadas:
(x1, y1) , (x2, y2) … el punto medio tendrá por coordenadas
.                           (x, y) = ( x1+x2)/ 2 , (y1+y2) / 2 )

TextWindow.WriteLine(“INPUT x1″)
x1= TextWindow.ReadNumber()
TextWindow.WriteLine(“INPUT y1″)
y1= TextWindow.ReadNumber()
TextWindow.WriteLine(“INPUT x2″)
x2= TextWindow.ReadNumber()
TextWindow.WriteLine(“INPUT y2″)
y2= TextWindow.ReadNumber()
x = (x1 + x2)/2
y= (y1 + y2)/2
TextWindow.WriteLine(“x =  ” + x + “   y = ” + y)
GraphicsWindow.Width = 240
GraphicsWindow.Height = 240
GraphicsWindow.PenColor = “Blue”
GraphicsWindow.DrawLine(x1, y1, x2, y2)
GraphicsWindow.PenWidth = 10
GraphicsWindow.PenColor = “Red”
GraphicsWindow.DrawEllipse(x, y, 20, 20)


http://www.empiezoinformatica.wordpress.com