QBASIC Programs
QBASIC Programs
Upper section of the program is used to print if the entered number is odd or even whereas the lower
section of the program is used to print if the entered number is prime or composite.
2. Program to input 7 numbers and print them in ascending order.In this program a(1) is the lowest
number,a(2) is the second lowest and so on. In this way the maximum number will be a(7).(To print in
descending order change IF a(i)>a(i+1)to IF a(i)<a(i+1)).
3. The program prints the program as shown in the output. The first for loop prints the first pattern, secon
the second pattern and third loop the third pattern.
4. Program illustrates the use of RIGHT$, LEFFT$ and MID$.
5. Program is used to find if the entered number is palindrome or not. To find the reverse of the number
just ignore the part after WEND statement and replace it with PRINT SUM.
6. Program is used to find if the entered string is palindrome or not. To find the reverse of the stringjust
ignore the part after NEXT statement and replace it with PRINT b$.
7. Program to print the displayed pattern. The statement PRINT:PRINT:PRINT:PRINT separates the two
programs.
8. Program displays the shown pattern of numbers. To print the fibonacci series just write PRINT c, to print
the pattern 1,2,2,4,8,32… just write PRINT c^i and to print the pattern 1 2 9 64… write the last section.
9. Program to print if the entered number is prime or composite using IF….THEN…ELSE and GOTO
statement.
10. Program to print the first 100 prime numbers.
11. Program to print maximum of 3 numbers.
12. Program to print the sum of even numbers between 1 and 100 and also the sum of odd numbers from 1
to 100.
13. Program to print the displayed pattern. First pattern and second pattern are separated by remark.
14. Program to print the factorial of the entered number.
15. Program to print the value of cos(x) using taylor’s series.
16. Program to find the area of circle using single line DEF FN.
17. Program to find the factorial of the entered number using DEF FN statement.
18. Program to find if the entered number is prime of composite using DECLARE FUNCTION statement.
19. Program to find if the entered number is armstrong or not using SUB END SUB statement.
20. Program to show the use of DO WHILE loop.
21. Program to show the use of DO UNTIL loop.
22. Program to print the transpose of matrix.
23. Program to print prime numbers between 1 and 1000.
24. Program to print random numbers from 1 to N.
25. Program to write records onto a file, read the written record and print them.
1
3
4
5 6
7
8
9 10
11 12
13
14 15
16 17
18
In the above figure, first block shows the body of the program, the second block the function declaration and statements and the
third block shows the output of the program
19
20 21
22
23
24