January 19, 2020

WAP to display the series: 2,2,4,6,10,......., up to 10th term

(using DO - LOOP)
CLS
a = 2 : b = 2 : I = 1
PRINT a; b;
DO WHILE I <= 8
c = a+ b
PRINT c;
a = b
b = c
I = I + 1
LOOP
END

(using FOR - NEXT)
CLS
a = 2 : b = 2
PRINT a; b;
FOR I = 1 TO 8
c = a + b
PRINT c;
a = b
b = c
NEXT I
END

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.