Diagonals of a polygon.
Appears on
Library tape of the Indiana Sinclair Timex User’s Group.
Source Code
10 INK 7: PAPER 0: BORDER 0: CLS 20 PRINT "diagonals of a polygon" 30 LET i=6.3 40 DIM x(25): DIM y(25) 50 FOR n=4 TO 20 60 LET x(1)=128: LET y(1)=90 70 FOR a=1 TO n 80 LET x(a+1)=128+70*SIN (i*a/n) 90 LET y(a+1)=90+70*COS (i*a/n) 100 NEXT a 110 CLS 120 PRINT AT 21,0;n;" Sides";" ";n*(n-3)/2;" diagonals" 130 FOR t=1 TO n+1 140 FOR q=t TO n+1 150 PLOT x(t),y(t): DRAW x(q)-x(t),y(q)-y(t) 160 NEXT q: NEXT t 170 NEXT n