cls dim x(50) dim y(50) print print "Lagrangian Interpolation" print input "Number of points to input? "; p for i=1 to p cls print print "x of point ";i; input " = "; x1 print "y of point ";i; input " = "; y1 x(i)=x1 y(i)=y1 next i [again] cls print print "Interpolate: x= "; input " "; a b=0 for j=1 to p t=1 for i=1 to p if i<>j then t=t*(a-x(i))/(x(j)-x(i)) next i b=b+t*y(j) next j print " y= ";b print print "Another point? (y/n)"; input " ";c$ if c$="y" goto [again] cls end