DIM T, M AS INTEGER M=0 FOR T=1 TO 20 M=M+F(T)*T NEXT T PRINT M FUNCTION F(x) IF (X%2)=0 THEN F=1 ELSE F=-1 END FUNCTION