You are on page 1of 1

12.07 what is the difference between simple and subscripted variables? Explain with Example?

Simple Variables: A simple variable is used to allocate the space for a fix value may be integer, float,
character or string. For example: Let A = 10 or INPUT entre value of A = ; A
Subscripted Variables: subscripted variables are mostly used to define a variable for an array, where an
array is a set of same data types. It is used with help of loop. For example:
10 FOR K = 1 TO 5
20 READ A (K)
30 NEXT K
40 DATA 1 2 3 4 5
50 END

12.10 write a program that fills an array with 12.11 Write a program that fills an array P
16 random integers each between 25 and 60, with 20 numbers READ from a DARA list,
then prints the array? then PRINTS the product of the elements of
10 DIM P (16) the array?
20 FOR A = 1 TO 16 10 LET A = 1
30 INPUT P(A) 20 DIM P (20)
40 IF P(A) < 25 OR P(A) > 60 THEN PRINT 30 FOR X = 1 TO 20
WRONG ENTRY ; 40 READ P(X)
50 GOTO 30 50 D = P(X) * D
60 NEXT A 60 NEXT X
70 FOR B =1 TO 16 70 DATA 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
80 PRINT P(B) 14, 15, 16, 17, 18, 19, 20
90 NEXT B 80 PRINT D
100 END 90 END

You might also like