10 PRINT        "AREA OF A POLYGON"
20 PRINT
29 REM - COORDINATE ARRAYS SHOULD BE SET TO (NUMBER OF VERTICES+1)
30 DIM X(25),Y(25)
40 PRINT "NUMBER OF VERTICES (ENTER 0 TO END PROGRAM)";
50 INPUT N
59 REM - END PROGRAM?
60 IF N=0 THEN 230
69 REM - LOOP TO ENTER COORDINATES IN ORDER OF SUCCESSIVE VERTICES
70 FOR I=1 TO N
80 IF I>1 THEN 110
90 PRINT "COORDINATES OF VERTEX";I;
100 GOTO 120
110 PRINT "               VERTEX";I;
120 INPUT X(I),Y(I)
130 NEXT I
139 REM - FIRST VERTEX SERVES AS LAST VERTEX
140 X(N+1)=X(1)
150 Y(N+1)=Y(1)
160 A=0
169 REM - CALCULATE AREA, PRINT
170 FOR I=1 TO N
180 A=A+(X(I)+X(I+1))*(Y(I)-Y(I+1))
190 NEXT I
200 PRINT "AREA =";A/2
210 PRINT
219 REM - RESTART PROGRAM
220 GOTO 40
230 END
