Successive subtraction, what am I missing?
Posted: Fri Jan 11, 2019 2:49 pm
Hi Again BASIC people,
I am missing something here, but I cannot put my finger on it. I have an array of random numbers, and want to subtract each value from the one preceding it:
205 DIM x(5)
210 FOR a=5 TO 2 STEP -1
215 LET x(a)=INT (RND*10)+1
250 PRINT "x(a)=";x(a);" x(a-
1)=";x(a-1)
305 PRINT "x(a)-x(a-1)=";x(a)-x
(a-1)
325 NEXT a
330 PRINT
But the subscript subtraction is not working. What am I missing?
Cheers, and thank you folks.
KB
I am missing something here, but I cannot put my finger on it. I have an array of random numbers, and want to subtract each value from the one preceding it:
205 DIM x(5)
210 FOR a=5 TO 2 STEP -1
215 LET x(a)=INT (RND*10)+1
250 PRINT "x(a)=";x(a);" x(a-
1)=";x(a-1)
305 PRINT "x(a)-x(a-1)=";x(a)-x
(a-1)
325 NEXT a
330 PRINT
But the subscript subtraction is not working. What am I missing?
Cheers, and thank you folks.
KB