Monday, October 11, 2021

Program to Print the Fibonacci Series 1, 1, 2, 3, 5, 8 ... up to 10th term

Using FOR...NEXT

CLS
x = 1
y = 1
PRINT x; y;
FOR i = 1 TO 10
     z = x + y
     PRINT z;
     x = y
     y = z
NEXT i
END


Using WHILE...WEND

CLS
x = 1
y = 1
i = 1
PRINT x; y;
WHILE i <= 10
     z = x + y
     PRINT z;
     x = y
     y = z
     i = i + 1
WEND
END


Using DO...LOOP

CLS
x = 1
y = 1
i = 1
PRINT x; y;
DO WHILE i <= 10
     z = x + y
     PRINT z;
     x = y
     y = z
     i = i + 1
LOOP
END

No comments:

Post a Comment

If you have any doubts, Please let me know.

[Download PDF] Computer Science Book Gread-10 in Nepali Language

 If you are searching for class 10 Computer Science in Nepali pdf for free download then you are at the right page. This book is soley publi...