BASIC练习题
20 FOR I=1 To 3
30 FOR J=1 To 3
40 Read M(I,J)
50 NEXT J
60 NEXT I
70 FOR I=2 TO 3
80 FOR J=1 TO 2
90 Let K=M(I,J)
100 Let M(I,J)=M(J,I)
110 Let M(J,I)=K
120 PRINT M(I,J)
130 NEXT J
140 NEXT I
150 DATA 9,8,7,6,5,4,3,2,1
160 ENDA. 5 B. 7 C. 4 D. 8
2.下述程序(设N=10)运行后结果为 (68) 。
10 INPUT N
15 PRINT
20 DIM M(N)
25 LET Y=0
30 FOR I=1 TO N
35 READ X
40 IF X<0 THEN GOSUB 500
45 NEXT I
50 FOR K=1 TO Y
55 PRINT M(K);
60 NEXT K
65 DATA 1,-1.1,2,-2.2,3,-4,5,-2.5,4,-8,-7
70 END500 LET Y=Y+1510 LET M(Y)=-X^2520 RETURNA. -1 -4 -6 -25 -16 B. 1.21 4.84 16 6.25 64C. 1 4 6 25 16 D. -1.21 -4.84 -16 -6.25 -64