Page 1 of 1

Repeating same calculations with incremental variable

Posted: Sat Jan 16, 2010 1:47 pm
by LEGRAND
Can you tell me how it is possible to use a loop to make several time the same calculation:exemple
Y=SIN(A)
with A= 2,3,4,5 etc
something like
FOR N=1 TO 10
PRINT Y=SIN(N)
NEXT N
Many thanks in advance

Posted: Sat Jan 16, 2010 4:51 pm
by burger2227
You cannot PRINT a variable definition, but you get no error either!

Your code:

FOR N = 1 TO 10
PRINT Y = SIN(N)
NEXT N

Print the variable value:

FOR N = 1 TO 10
Y = SIN(N)
PRINT Y
NEXT N

OR just print the function return:

FOR N = 1 TO 10
PRINT SIN(N)
NEXT N


SIN and COS use radian values up to 2 * PI = 6.28. Going above that creates negative values.

formula with incremental values

Posted: Sun Jan 17, 2010 11:11 am
by LEGRAND
THANKS A LOT!