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

Articles by "learn qbasic"
About RAM Advantages of multiprocessing system Associative memory Binary Number System CA CA Notes Change drive icon change pendrive icon Computer Abbreviation Computer Architecture Computer fundamental MCQ Computer Generation Computer generation computer notes Computer MCQ Computer Network MCQ Computer Operator MCQ Critical Section Critical section in OS Database connectivity in java Deadlock avoidance Deadlock detection algorithm Deadlock Detection and Recovery Deadlock detection method Deadlock Handling Deadlock in OS Deadlock Prevention Deadlock Recovery define object and class Define system cell Descrete Structure Device Driver Device driver in computer device driver in os DFA DFA contains with DFA ends with dfa examples dijkstra's algorithm Discrete Structure Discrete Structure graph theory Download JDBC Driver Download MySql Download PUBG DS DS Notes FCFS Job Scheduling Algorithm Finding shortest path Finite Sate Automata Flynn's Classifications fragmentation in computer fragmentation in harddisk fragmentation in os fragmented memory Full form related to computer Generations of operations Generations of OS Graph theory ICT 1st semester notes Instruction Address Modes Java java array declaration java class and object example Java Database connectivity example java event handling example program Java JDBC Java JMenuBar Java JSP program example java notes java program methods example Java program to create class and object java program to create methods java program to print even number between any two numbers Java programming java programming notes Java programs Java question answer java swing example java swing program to calculate simple interest Java Tutorials JSP program learn qbasic Lekh MCQ MCQ Computer MCQ Operating System memory fragmentation MICT 1st semester notes mict 1st semester operating system notes MICT first semester notes Multiprocessing mutex in os Necessary conditions for deadlock Number System Operating System Operating system notes OS OS Notes OS Numeric pattern printing program in qbasic patterns in qbasic Pipeline Hazards Pipelining Pipelining concept prime or composite in qbasic print patterns qbasic print series in qbasic Printing Series in qbasic PUBG PUBG Mobile PUBG PC PUBG Story qbasic qbasic code qbasic for class 10 qbasic for class 8 qbasic for class 9 qbasic for school QBASIC Pattern printing qbasic pattern printing program qbasic pattern printing programs qbasic pattern types qbasic patterns qbasic programming tutorials qbasic programs qbasic sequence printing programs qbasic tutorials Race Condition in Operating system reverse order in qbasic RISC and CISC RISC Pipeline Scheduling algorithm segmentation in operating system segmentation in os semaphore and mutex Semaphore concept in os Semaphore in os semaphore in os notes semaphore meaning sequential programs in qbasic series in qbasic series printing programs in qbasic shell in operating system shell in os shortest path shortest path algorithm simple interest program in java swing System Bus System Cell Teach Blog Tech Blog Tech School technical school The Shell in Operating system types of fragmentation Types of Multiprocessor types of operating system Types of pipeline hazards View Connected Wifi password Virtual Memory Virtual memory in OS Von Neumann's architecture What is associative memory? what is class? What is computer system? What is Fragmentation? What is jsp? what is object? What is process? What is segmentation What is System Cell What is Thread? what is virtual memory in computer What is virtual memory? पब्जी गेम

1) WAP to display "Hello World" on the screen
CLS
PRINT "Hello World!"
END
 
2) WAP to display your name address and school name.
CLS
CLS
PRINT "Your name"
PRINT "Your Address"
PRINT "Your school name"
END

3) WAP display the sum of 20, 30 and 10.
CLS
CLS
a = 20
b = 30
c = 10
add = a + b + c
PRINT "The sum = "; add
END

 4) Write a program to get 2 numbers from the user and display the sum.
CLS
CLS
INPUT "Enter first number "; x
INPUT "Enter second number "; y
add = x + y
PRINT "The sum = "; add
END

5) WAP to enter length and breadth of room and print the area of room. [Hints: A=(l*b)]
CLS
CLS
INPUT "Enter length of room "; l
INPUT "Enter breadth of room"; b
a = l * b
PRINT "Area of room = "; a
END

6) WAP to enter length and breadth of room and display the perimeter of room. [Hints: P=2(l+b)]
CLS
INPUT "Enter length of room "; l
INPUT "Enter breadth of room"; b
p = 2 * (l + b)
PRINT "Area of room = "; p
END

7) WAP to enter radius of a circle; then calculate and display its area. [Hints: A=πr2]
CLS
CLS
INPUT "Enter the radius of circle "; r
a = (22 / 7) * r ^ 2
PRINT "Area of Circle = "; a
END

8) WAP to input temperature in Celsius and calculate its temperature in Fahrenheit. [Hints: F=9/5*c+32]
CLS
INPUT "Enter temperature in Celsius "; c
f = 9 / 5 * c + 32
PRINT "Temperature in Fahrenheit = "; f
END

9) WAP to input temperature in Fharenheit and calculate its temperature in Celsius. [Hints: C=(F-32)*5/9]
CLS
INPUT "Enter temperature in Fahrenheit "; f
c = (f - 32) * 5 / 9
PRINT "Temperature in Celsius = "; c
END

10) WAP to enter Principal (P), Time (T) and Rate (R) and display simple interest. [Hints: I=PTR/100]
CLS
INPUT "Enter P "; p
INPUT "Enter T "; t
INPUT "Enter R "; r
i = p * t * r / 100
PRINT "Simple Interest = "; i
END

11) WAP to enter length, breadth and height and print volume. [Hints: v = l*b*h]
CLS
INPUT "Enter Length "; l
INPUT "Enter Breadth "; b
INPUT "Enter Height "; h
v = l * b * h
PRINT "Volume = "; v
END
   
12) WAP to enter distance into K.M and convert it into M. [Hints: 1km = 1000m]
CLS
INPUT "Enter distance in K.M "; km
m = km * 1000
PRINT km; " K.M = "; m; "M"
END
   13) WAP to input name of item, price of item and quantity then calculate the amount [Amount = price * quantity]
CLS
INPUT "Enter the name of Item "; iname$
INPUT "Enter Price Per Unit "; p
INPUT "Enter Quantity "; q
a = p * q
PRINT "Total Amount = "; a
END
    14)  WAP that ask you to input a number; then calculate the square and square root of that number. 
CLS
INPUT "Enter a Number "; n
PRINT "Square = "; n ^ 2
PRINT "Square Root = "; SQR(n)
END
    15)  WAP to calculate the area of triangle. [Hints: A=1/2(b*h)] 
CLS
INPUT "Enter Breadth "; b
INPUT "Enter Height "; h
a = 1 / 2 * (b * h)
PRINT "Area of Triangle = "; a
END
   16)  WAP to calculate the area of triangle. [Hints: A=1/2(b*h)] 
CLS
INPUT "Enter Breadth "; b
INPUT "Enter Height "; h
a = 1 / 2 * (b * h)
PRINT "Area of Triangle = "; a
END
   17)  WAP to calculate the area of 4 walls. [Hints: A = 2H(L + B)
CLS
INPUT "Enter Length "; l
INPUT "Enter Breadth "; b
INPUT "Enter Height "; h
a = 2 * h * (l + b)
PRINT "Area of 4 wall = "; a
END
    17)  WAP to print the area of triangle when 3 sides are given.
CLS
INPUT "Length of First Side "; a
INPUT "Length of Second Side "; b
INPUT "Length of Third Side "; c
S = (a + b + c) / 2
ar = (S * (S - a) * (S - b) * (S - c)) ^ 1 / 2
PRINT "Area of Triangle = "; ar
END
    18)  WAP to enter time in second and convert into hour minute and second. 
CLS
INPUT "Enter time in second "; s
h = s \ 3600
s = s MOD 3600
m = s \ 60
s = s MOD 60
PRINT "Hour = "; h
PRINT "Minute = "; m
PRINT "Second ="; s
END
   Visit YouTube Channel : https://www.youtube.com/technicalschoolnepal
Face Book Page : https://www.facebook.com/technicalschoolnepal


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


 QBASIC Programs to print series using different Looping Statements

1) 5, 25, 125, 625, 3125 .... up to 7th terms.

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
a = 5
FOR i = 1 TO 7
    PRINT a;
    a = a * 5
NEXT i
END
CLS
a = 5
i = 1
WHILE i <= 7
    PRINT a;
    a = a * 5
    i = i + 1
WEND
END
CLS
a = 5
i = 1
DO WHILE i <= 7
    PRINT a;
    a = a * 5
    i = i + 1
LOOP
END

2) 1, 4, 9, 16, 25 .... up to 10th term.

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

3) 1, 8, 27, 64, 125 ... up to 10th term.

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

4) 1, 27, 125, 343, 729

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 1
FOR i = 1 TO 5
    PRINT n ^ 3;
    n = n + 2
NEXT i
END
CLS
n = 1
i = 1
WHILE i <= 5
    PRINT n ^ 3;
    n = n + 2
    i = i + 1
WEND
END
CLS
n = 1
i = 1
DO
    PRINT n ^ 3;
    n = n + 2
    i = i + 1
LOOP WHILE i <= 5
END

5) 1000, 500, 250, 125, 62.5

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 1000
FOR i = 1 TO 5
    PRINT n;
    n = n / 2
NEXT i
END
CLS
n = 1000
i = 1
WHILE i <= 5
    PRINT n;
    n = n / 2
    i = i + 1
WEND
END
CLS
n = 1000
i = 1
DO
    PRINT n;
    n = n / 2
    i = i + 1
LOOP WHILE i <= 5
END

6) 10, 8, 6, 4, 2

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
FOR i = 10 TO 1 STEP -2
    PRINT i;
NEXT i
END
CLS
i = 10
WHILE i >= 1
    PRINT i;
    i = i - 2
WEND
END
CLS
i = 10
DO WHILE i >= 1
    PRINT i;
    i = i - 2
LOOP
END

7) 1, 3, 5, 7, 9 ...... 25

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
FOR i = 1 TO 25 STEP 2
    PRINT i;
NEXT i
END
CLS
i = 1
WHILE i <= 25
    PRINT i;
    i = i + 2
WEND
END
CLS
i = 1
DO
    PRINT i;
    i = i + 2
LOOP UNTIL i >= 25
END

8) 0, 2, 4, 6, 8 ...... up to 100

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
FOR i = 0 TO 100 STEP 2
    PRINT i;
NEXT i
END
CLS
i = 0
WHILE i <= 100
    PRINT i;
    i = i + 2
WEND
END
CLS
i = 0
DO WHILE i <= 100
    PRINT i;
    i = i + 2
LOOP
END

9) 5, 125, ... up to 7th term.

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 5
FOR i = 1 TO 7
    PRINT n;
    n = n ^ 3
NEXT i
END
CLS
n = 5
i = 1
WHILE i <= 7
    PRINT n;
    n = n ^ 3
    i = i + 1
WEND
END
CLS
n = 5
i = 1
DO WHILE i <= 7
    PRINT n;
    n = n ^ 3
    i = i + 1
LOOP
END

10) 0.1, 0.11, 0.111 .... up to 7th term.

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
a = 0.1
FOR i = 1 TO 7
    PRINT a;
    a = a / 10 + 0.1
NEXT i
END
CLS
a = 0.1
i = 1
WHILE i <= 7
    PRINT a;
    a = a / 10 + 0.1
    i = i + 1
WEND
END
CLS
a = 0.1
i = 1
DO
    PRINT a;
    a = a / 10 + 0.1
    i = i + 1
LOOP WHILE i <= 7
END

11) 5, 55, 555 .... up to 7th terms.

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

12) 3333333, 333333, 33333, 3333 .... 3

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 3333333
FOR i = 1 TO 7
    PRINT n;
    n = n \ 10
NEXT i
END
CLS
n = 3333333
i = 1
WHILE i <= 7
    PRINT n;
    n = n \ 10
    i = i + 1
WEND
END
CLS
n = 3333333
i = 1
DO WHILE i <= 7
    PRINT n;
    n = n \ 10
    i = i + 1
LOOP
END

13) 0.11111, 0.1111, 0.111 .... 0.1

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

14) 1, 1, 2, 3, 5, 8 ... up to 10th term. (Fibonacci Series)

FOR ... NEXT WHILE ... WEND DO ... LOOP
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
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
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

15) 3, 10, 5, 16, 8 (Hill-stone Number).

FOR ... NEXT WHILE ... WEND DO ... LOOP
CLS
n = 3
FOR i = 1 TO 5
    PRINT n;
    IF n MOD 2 = 0 THEN
        n = n / 2
    ELSE
        n = n * 3 + 1
    END IF
NEXT i
END
CLS
n = 3
i = 1
WHILE i <= 5
    PRINT n;
    IF n MOD 2 = 0 THEN
        n = n / 2
    ELSE
        n = n * 3 + 1
    END IF
    i = i + 1
WEND
END
CLS
n = 3
i = 1
DO WHILE i <= 5
    PRINT n;
    IF n MOD 2 = 0 THEN
        n = n / 2
    ELSE
        n = n * 3 + 1
    END IF
    i = i + 1
LOOP
END

Need More ? Visit : Sequence and Series SET-2

1)
5
54
543
5432
54321


CLS
FOR i = 5 TO 1 STEP -1
    FOR j = 5 TO i STEP -1
        PRINT j;
    NEXT j
    PRINT
NEXT i
END
2)
54321
5432
543
54
5

CLS
FOR i = 1 TO 5 STEP 1
    FOR j = 5 TO i STEP -1
        PRINT j;
    NEXT j
    PRINT
NEXT i
END
3)
1
12
123
1234
12345


CLS
FOR i = 1 TO 5
    FOR j = 1 TO i
        PRINT j;
    NEXT j
    PRINT
NEXT i
END
4)
12345
1234
123
12
1


CLS
FOR i = 5 TO 1 STEP -1
    FOR j = 1 TO i STEP 1
        PRINT j;
    NEXT j
    PRINT
NEXT i
END
5)
1
22
333
4444
55555


CLS
FOR i = 1 TO 5
    FOR j = 1 TO i
        PRINT i;
    NEXT j
    PRINT
NEXT i
END
6)
55555
4444
333
22
1


CLS
FOR i = 5 TO 1 STEP -1
    FOR j = 1 TO i STEP 1
        PRINT i;
    NEXT j
    PRINT
NEXT i
END
7)
   

    *
   ***
  *****
 *******
*********


CLS
s$ = "*********"
t = 10
FOR i = 1 TO LEN(s$) STEP 2
    PRINT TAB(t); LEFT$(s$, i)
    t = t - 1
NEXT i
END
8)
2
22
222
2222
22222

CLS
n = 2
FOR i = 1 TO 5
    PRINT n
    n = n * 10 + 2
NEXT i
END
9)
1
11
111
1111
11111


CLS
n = 1
FOR i = 1 TO 5
    PRINT n
    n = n * 10 + 1
NEXT i
END
10)
11111
1111
111
11
1


CLS
n = 11111
FOR i = 1 TO 5
    PRINT n
    n = n \ 10
NEXT i
END
11)

R
ER
TER
UTER
PUTER
MPUTER
OMPUTER
COMPUTER
CLS
X$ = "COMPUTER"
FOR i = 1 TO LEN(X$)
    PRINT RIGHT$(X$, i)
NEXT i
END
12)
C
CO
COM
COMP
COMPU
COMPUT
COMPUTE
COMPUTER
CLS
X$ = "COMPUTER"
FOR i = 1 TO LEN(X$)
    PRINT LEFT$(X$, i)
NEXT i
END
13)
*
**
***
****
*****

CLS
a$ = "*****"
FOR i = 1 TO LEN(a$)
    PRINT LEFT$(a$, i)
NEXT i
END
14)

*****
****
***
**
*

CLS
a$ = "*****"
FOR i = LEN(a$) TO 1 STEP -1
    PRINT LEFT$(a$, i)
NEXT i
END
15)
*********
*******
*****
***
*


CLS
a$ = "*********"
FOR i = LEN(a$) TO 1 STEP -2
    PRINT LEFT$(a$, i)
NEXT i
END
16)
*********
 *******
  *****
   ***
    *


CLS
x$ = "*********"
b = 1
t = 20
FOR i = LEN(x$) TO 1 STEP -2
    PRINT TAB(t); MID$(x$, b, i)
    b = b + 1
    t = t + 1
NEXT i
END

Need more patterns ? click here ... (Patterns in QBASIC SET-2)

Visit My YouTube Channel : Technical School

MKRdezign

Contact Form

Name

Email *

Message *

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