To print the fibonacci series

Using FOR ..... NEXT

CLS
a = 1
b = 1
PRINT a;
PRINT b;
FOR i = 1 TO 8
    c = a + b
    PRINT c;
    a = b
    b = c
NEXT i
END


Using WHILE ..... WEND
  •  CLS
    i = 1
    a = 1
    b = 1
    PRINT a
    PRINT b
    WHILE i <= 10
        c = a + b
        PRINT c
        a = b
        b = c
        i = i + 1
    WEND
    END

Share :

Twitter

Random Posts

Back To Top

facebook main

counter

Powered by Blogger.