Computer Notes, Programming codes, Hardware and Networking Tip, Entertainment, Biography, Internet Tip, Tech News, Latest Technology, YouTube,

Printing Series in QBASIC (SET-2)


1) 8, 18, 32, 50 ...... up to 10th term.

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
FOR i = 2 TO 10
    PRINT i ^ 2 * 2;
NEXT i
END
CLS
i = 2
WHILE i <= 10
    PRINT i ^ 2 * 2;
    i = i + 1
WEND
END
CLS
i = 2
DO WHILE i <= 10
    PRINT i ^ 2 * 2;
    i = i + 1
LOOP
END

2) 2, 4, 8, 16, 32 upto 10th term. 

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 2
FOR i = 1 TO 10
    PRINT n;
    n = n * 2
NEXT i
END
CLS
n = 2
i = 1
WHILE i <= 10
    PRINT n;
    n = n * 2
    i = i + 1
WEND
END
CLS
n = 2
i = 1
DO WHILE i <= 10
    PRINT n;
    n = n * 2
    i = i + 1
LOOP
END

3) 2, 4, 6, 10, 16 ..... up to 10th term.(Fibonacci Series)

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
x = 2
y = 4
PRINT x; y;
FOR i = 1 TO 10
    z = x + y
    PRINT z;
    x = y
    y = z
NEXT i
END
CLS
x = 2
y = 4
i = 1
PRINT x; y;
WHILE i <= 10
    z = x + y
    PRINT z;
    x = y
    y = z
    i = i + 1
WEND
END
CLS
x = 2
y = 4
i = 1
PRINT x; y;
DO WHILE i <= 10
    z = x + y
    PRINT z;
    x = y
    y = z
    i = i + 1
LOOP
END

4) 4, 4, 8, 12, 20 ..... up to 10th term. (Fibonacci Series)

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
x = 4
y = 4
PRINT x; y;
FOR i = 1 TO 10
    z = x + y
    PRINT z;
    x = y
    y = z
NEXT i
END
CLS
x = 4
y = 4
i = 1
PRINT x; y;
WHILE i <= 10
    z = x + y
    PRINT z;
    x = y
    y = z
    i = i + 1
WEND
END
CLS
x = 4
y = 4
i = 1
PRINT x; y;
DO WHILE i <= 10
    z = x + y
    PRINT z;
    x = y
    y = z
    i = i + 1
LOOP
END

5) 8, 18, 32, 50 ..... up to 10th term. 

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
FOR i = 2 TO 10
    PRINT i ^ 2 * 2;
NEXT i
END
CLS
i = 2
WHILE i <= 10
    PRINT i ^ 2 * 2;
    i = i + 1
WEND
END
CLS
i = 2
DO WHILE i <= 10
    PRINT i ^ 2 * 2;
    i = i + 1
LOOP
END

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget