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

February 2019
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? पब्जी गेम

आजको यो टेक्नोलोजीको संसारमा हामी सबैलाई केहि सामन्न्य टेक्नोलोजिकल ज्ञान हुन आवश्यक छ।  हामी आज कम्प्युटर र स्मार्ट फोनेहरुमा प्रयोग हुने RAM (Random Access Memory) को बारेमा जान्ने छौ।  RAM को कुरा गर्दा यो computer होस्, laptop होस् या mobile phone, यो एकदमै महत्वपूर्ण चिज हो।  किनभने RAM कै कारणले यी device हरुले राम्रोसंग काम गरिरहेका हुन्छन्।

Picture of Ram attached on the motherboard
RAM attached on the Motherboard
RAM को पुरा रुप हुन्छ Random Access Memory। RAM एउटा अत्यन्त छिटो प्रकारको कम्प्युटर मेमोरी हो।  जसले अस्थायी रूपमा तपाइको कम्प्युटर वा स्मार्ट फोनको डाटा हरु भण्डारण गर्दछ। यो मेमोरीले हार्डडिस्कले भन्दा धेरै गुना छिटो काम गर्छ।  CPU ले  कुनै डाटा प्रोसेस गर्नु भन्दा अगाडी त्यो डाटा RAM मा load हुन्छ र RAM को डाटा CPU ले पढेर data मा भएको instructions को आधारमा कम्प्युटर ले काम गर्छ। Hard Disk धेरै नै ढिलो चल्ने device हो र CPU धेरै छिटो चल्ने device हो । CPU ले एक सेकेन्ड मै लाखौ instruction हरु execute गर्न सक्छ। अब, CPU ले Hard Disk को डाटा रिड गर्दा त Hard Disk को डाटा CPU सम्म आउन धेरै समय लाग्ने भयो र कम्प्युटरमा हरेक कम ढिलो हुने भयो । त्यसैले, CPU ले रिड गर्न चाहेको file/data लाई आगाडी नै RAM मा copy गरिन्छ र त्यो डाटा लाई छिटो भन्दा छिटो CPU सम्म पुर्याउने काम RAM ले गर्छ।  



RAM ले कम्प्युटरको power on भए सम्म मात्र data हरु store गर्छ । जब हामी आफ्नो कम्प्युटर लाइ off गर्छौ, तब RAM को सबै data हरु पनि मेटीन्छ। त्येसैले यसलाई volatile र temporary मेमोरी पनि भनिन्छ। जब कम्प्युटर on गरिन्छ तब केहि operating system का file हरु storage device जस्तै Hard Disk बाट load भएर RAM आउँछ।  कम्प्युटरमा हामी केहि application software हरु run गर्छौ र विभिन्न प्रकारका document हरु बनाउँछौं।  ति सबै document हरु हामीले save नगरुन्जेल सम्म RAM मा नै store भएर बसेको हुन्छ।  हामीले त्यो document लाई save गरे पछि मात्र त्यो document Hard Disk मा स्टोर हुन्छ। यसरि RAM ले Random data हरु स्टोर गर्ने र CPU ले RAM को data लाई सिदै Access गर्ने भएको हुनाले नै यसलाई Random Access Memory र Working Memory भनिएको हो। 
Picture of Computer RAM
RAM (Random Access Memory)
कम्प्युटर वा स्मार्ट फोनहरुमा हामीले एकै पटक धेरै application हरु run गर्दा, यदि RAM को capacity कम छ भने हाम्रो कम्प्युटर वा स्मार्ट फोन हरु ढिलो चल्न थाल्छ र hang हुन्छ।  त्यसैले धेरै capacity भएको RAM Multi Tasking को  लागि उपर्युक्त हुन्छ। आज भोलि को स्मार्ट फोन मा त झन् कम्तिमा पनि 2 GB को RAM त हुनै पर्छ।  हामीले फोन मा Facebook application खोल्दा यसले मात्रै २०० देखि ३०० MB सम्मको RAM प्रयोग गर्छ।  यस्तै हामी धेरै application हरु जस्तै Messenger,  Viber, WhatsApp, YouTube जस्ता application हरु एकै पटक प्रयोग गर्छौ।  जसले धेरै RAM को खपत गर्छ।  त्यसैले यदि तपाई कुनै स्मार्ट फोन किन्ने सोचमा हुनुहुन्छ भने RAM धेरै capacity भएको फोन नै किन्नु होला।  किनकि एक पटक तपाईले स्मार्ट फोन किनेपछि तपाईले त्यस फोनमा भएको RAM को capacity बढाउन सक्न्नुहुन्न। तर कम्प्युटरमा भने तपाईले अर्को RAM राख्न सक्नुहुन्छ।



अन्य मेमोरीहरुको तुलनामा RAM बनाउन धेरै खर्च लाग्छ। त्यसैले यो निकै महँगो हुन्छ। 16 GB को मेमोरी कार्ड बनाउन लाग्ने खर्च 1 GB को RAM बनाउन मै लाग्छ। 



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)
PROGRAMMING
PROGRAMMIN
PROGRAMMI
PROGRAMM
PROGRAM
PROGRA
PROGR
PROG
PRO
PR
P

CLS
a$ = "PROGRAMMING"
FOR i = LEN(a$) TO 1 STEP -1
    PRINT LEFT$(a$, i)
NEXT i
END
2)
5
55
555
5555
55555


CLS
n = 5
FOR i = 1 TO 5
    PRINT n
    n = n * 10 + 5
NEXT i
END
3)
  P
 EPA
NEPAL




CLS
S$ = "NEPAL"
r = 1
t = 10
FOR i = 3 TO 1 STEP -1
    PRINT TAB(t); MID$(S$, i, r)
    r = r + 2
    t = t - 1
NEXT i
END
4)

123456787654321
 1234567654321
  12345654321
   123454321
    1234321
     12321
      121
       1


CLS
n# = 11111111
s = 10
FOR i = 1 TO 8
    PRINT SPACE$(s); n# * n#
    n# = n# \ 10
    s = s + 1
NEXT i
END
5)

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15



CLS
c = 1
FOR i = 1 TO 5
    FOR j = 1 TO i
        PRINT c;
        c = c + 1
    NEXT j
    PRINT
NEXT i
END
5)

1 3 5 7 9
1 3 5 7
1 3 5
1 3
1

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

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

1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
CLS
FOR i = 1 TO 9 STEP 2
    FOR j = 1 TO i STEP 2
        PRINT j;
    NEXT j
    PRINT
NEXT i
ENDa

Patterns in QBASIC SET-1
Visit My YouTube Channel : https://www.youtube.comtechnicalschoolnepal 
Facebook page : www.facebook.com/technicalschoolnepal
Complete QBASIC Course
Go to Practice Time


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