Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Tuesday, February 15, 2022

Comprehensive Guide to Numeric Series Programs in QBASIC

 Comprehensive Guide to Numeric Series Programs in QBASIC


Comprehensive Guide to Numeric Series Programs in QBASIC


Introduction


For students and programming enthusiasts, QBASIC provides a powerful yet simple platform for practicing and understanding numeric series. Whether you're studying for an exam or just looking to improve your coding skills, exploring numeric series with QBASIC can help you better understand loops, functions, and procedural programming. This guide covers a number of QBASIC programs designed to display various numerical series, each demonstrating fundamental programming concepts.

1) WAP to display the series  9,7,5…….1         

DECLARE SUB series( )

CALL series

END

 

SUB series

FOR n= 9 to 1 STEP -2

PRINT n;

NEXT n

END SUB

 

2) WAP to display the series  100  98  96  94………..50

DECLARE SUB series()

CLS

CALL series

END

 

SUB series

FOR x= 100 to 50 STEP -2

PRINT x;

NEXT

END SUB

 

3) WAP to print the series 1 2 4 7 ……..upto 15th term.

DECLARE SUB series()

CLS

CALL series

END

 

SUB series

a=1

FOR x= 1 TO 15

PRINT a;

a=a+x

NEXT x

END SUB

 

 

4) WAP to display the following sequence 5, 55, 555 upto 6th  term. (SLC 2064)

DECLARE SUB ser ()

CLS

CALL ser

END

SUB ser

a = 5

FOR x = 1 TO 6

PRINT a;

a = a * 10 + 5

NEXT x

END SUB

 

5) WAP to display the series like 55555 5555 555 55 5

DECLARE SUB ser( )

CLS

CALL ser

END

SUB ser

a=55555

x=1

WHILE x<=5

PRINT a;

a=a\10

x=x+1

WEND

 

6) WAP to display the series 1,8,27…… till 10th term.

DECLARE SUB out( )

CLS

CALL out

END

SUB out

x=1

WHILE x<=10

PRINT x^3

x=x+1

WEND

END SUB

 

7) WAP to display the series 1  4  9  25 …….10th term

DECLARE SUB series()

CLS

CALL series

END

 

SUB series

FOR x= 1 TO 10

PRINT x^2;

NEXT x

END SUB

 

8) WAP to display the series 5, 25, 125 .......... upto 10th term

DECLARE SUB series()

CLS

CALL series

END

 

SUB series

CLS

FOR I = 1 TO 10

PRINT 5 ^ I;

NEXT I

END SUB

 

 

9) WAP to print the series 2,8,18,32….upto 10th term.

DECLARE SUB ser( )

CLS

CALL ser

END

 

SUB ser

FOR x= 1 to 10

PRINT (x^2)*2;

NEXT x

END SUB

 

10) WAP to display the series 1,8,27,……10th term.

DECLARE SUB ser( )

CLS

CALL ser

END

SUB ser

a=1

DO

PRINT a^3

a=a+1

LOOP WHILE a<=10

END SUB

 

11) Write a program using to display given series up to 15th term 525, 500, 475, 450….

DECLARE SUB ser ()

CLS

CALL ser

END

SUB ser

a = 525

FOR x = 1 TO 15

PRINT a;

a = a - 25

NEXT x

 

12) WAP to display the series as : 5 6 9 14 21 30

DECLARE SUB ser( )

CLS

CALL ser

END

SUB ser

a=5: b=1

PRINT a;

FOR x= 1 to 5

c=a+b

PRINT c;

a=c

b=b+2

NEXT x

END SUB

 

13) WAP to display the series as 8 18 32 50 72 98……. 10th term

DECLARE SUB ser( )

CLS

CALL ser

END

SUB ser

a=2: b=6

FOR x= 1 to 10

c=a+b

PRINT c;

a=c

b=b+4

NEXT x

END SUB

 

14) WAP to display the series as 3 12 27 ……10th term.

DECLARE SUB ser( )

CLS

CALL ser

END

SUB ser

a=3

FOR x= 1 to 10

PRINT a*x;

a=a+3

NEXT x

END SUB

 

15) WAP to print the series 1,1,2,3,5,8…..upto 10th  terms. (SLC 2069)

         

DECLARE SUB fibo ()

CLS

CALL fibo

END

SUB fibo

a = 1

b = 1

FOR i = 1 TO 5

PRINT a; b;

a = a + b

b = a + b

NEXT

END SUB

 

16) WAP to display the series 2,4,8,16…10th term.

CLS

a = 1

FOR i = 1 TO 10

PRINT ser(a);

NEXT

END

FUNCTION ser (a)

a = a * 2

ser = a

END FUNCTION

 

 

17) WAP to display the series 50, 45, 35,....0

DECLARE FUNCTION r(a,b)
CLS
a=50
b=5
WHILE a>=0
PRINT r(a,b);
WEND

END


FUNCTION r(a,b)
r=a
a=a-b
b=b+5
END FUNCTION

 

18) WAP to display the series: 1  121  12321   1234321    123454321

DECLARE SUB series ()

CLS

CALL series

END

 

SUB series

a# = 1

FOR x = 1 TO 5

PRINT a# ^ 2;

a# = a# * 10 + 1

NEXT

END SUB

 

19) WAP  to display the series 7    22     11    34    17    52    26    13      40      20

DECLARE SUB series ()

CLS

CALL series

END

 

SUB series

a = 7
FOR i = 1 TO 10
PRINT a;
IF a MOD 2 = 0 THEN
a = a / 2
ELSE
a = a * 3 + 1
END IF
NEXT i
END SUB

 

20) WAP to display the series  3   12   27   48  ……… upto 10th  terms.

DECLARE SUB series ()

CLS

CALL series

END

 

SUB series

CLS
a = 3
FOR b = 1 TO 10
PRINT a * b^ 2;
NEXT j
END SUB


Conclusion


QBASIC offers a versatile platform for practicing numeric series using looping constructs and procedural programming techniques. By working through these examples, students and programmers can gain a solid understanding of how to generate and manipulate various numeric patterns in QBASIC.

Call to Action.


Explore these programs, experiment with the parameters, and create your own series to gain a better understanding of QBASIC. Stay tuned to our blog for more programming tips and tutorials to help you improve your coding skills!

You may also read:
https://neb-see-solution.blogspot.com/2024/02/pabson-see-pre-qualifying-exam-2080-solutions.html


No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages