Friday, July 8, 2011

Program

1) WAP to print the Fibonacci series
CLS
a = 1
b = 1
PRINT a, b,
FOR i = 1 TO 8
c = a + b
PRINT c,
a = b
b = c
NEXT i
END
……………………………………………………………………………….

2) WAP to print the factors of a given number
REM Program to print the factors of a given number
CLS
INPUT “Enter any number”; n
FOR i = 1 TO n
IF n MOD i = 0 THEN PRINT i,
NEXT i
END
…………………………………………………………………………………

3) WAP to print the greater among ten different numbers
REM Program to print greater number among ten different numbers
CLS
INPUT “Enter first number”; g
FOR i = 2 TO 10
INPUT “Enter next number”; a
IF a > g THEN g = a
NEXT
PRINT g; ” is the greatest number”
END

………………………………………………………………………………….
4) WAP to print the greater among three different numbers
REM Program to print greater among three different numbers
CLS
INPUT “Enter first number”; a
INPUT “Enter second number”; b
INPUT “Enter third number”; c
IF a > b AND a > c THEN
PRINT a; ” is greater”
ELSEIF b > a AND b > c THEN
PRINT b; ” is greater”
ELSE
PRINT c; ” is greater”
END IF
END
…………………………………………………………………………….

5) WAP to print the greater among two different numbers
REM Program to print the greater among two different numbers
CLS
INPUT “Enter first number”; a
INPUT “Enter second number”; b
IF a > b THEN
PRINT a; ” is greater”
ELSE
PRINT b; ” is greater”
END IF
END
………………………………………………………………………………..
6) WAP to calculate the cube root of a given number
REM Program to calculate the cube root of a given number
CLS
INPUT “Enter any number”; n
c = n ^ (1 / 3)
PRINT “Cube root of “; n; ” is “; s
END
…………………………………………………………………………………..

7) WAP to calculate the square root of a given number
REM Program to calculate the square root of a given number
CLS
INPUT “Enter any number”; n
s = SQR(n)
PRINT “Square root of “; n; ” is “; s
END
…………………………………………………………………………………..
8) Program to check the given number for palindrome in qbasic using declare sub
DECLARE SUB A (N)
CLS
INPUT “ENTER A NUMBER”; N
CALL A(N)
END
SUB A (N)
S = N
WHILE N <> 0
B = N MOD 10
R = R * 10 + B
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “IT IS PALINDROME”
ELSE
PRINT “IT IS NOT PALINDROME”
END IF
END SUB

………………………………………………………………………………..
9) Program to check given number for armstrong in qbasic using declare sub
DECLARE SUB A(N)
CLS
INPUT “ENTER A NUMBER”; N
CALL A(N)
END
SUB A(N)
S=N
WHILE N <> 0
B = N MOD 10
R = R + B ^ 3
N = FIX(N / 10)
WEND
IF S = R THEN
PRINT “THE GIVEN NUMBER IS ARMSTRONG”
ELSE
PRINT “IT IS NOT ARMSTRONG”
END IF
END SUB
………………………………………………………………………………….

10) Program to reverse a given string in qbasic
CLS
INPUT “ENTER A STRING”; S$
FOR I = LEN(S$) TO 1 STEP -1
M$ = MID$(S$, I, 1)
REV$ = REV$ + M$
NEXT I
PRINT REV$
END

………………………………………………………………………………..

11s) Program to convert decimal to binary in qbasic using declare function
DECLARE FUNCTION A$ (N)
CLS
INPUT “ENTER A NUMBER”; N
PRINT “BINARY EQUIVALENT IS”; A$(N)
END

FUNCTION A$ (N)
WHILE N <> 0
E = N MOD 2
B$ = STR$(E)
N = FIX(N / 2)
C$ = B$ + C$
WEND
A$=C$
END FUNCTION
………………………………………………………………………………….
Click here for more programs

132 comments:

  1. how to declare any number of factor in qbasic

    ReplyDelete
    Replies
    1. Use array to declare multiple variabls.

      Delete
    2. Input "enter a number"; n
      for I=1 to n
      If n mod I=0 then print I
      next I
      end

      Delete
    3. WAP to print the series 4 4 8 12 20..... to 8th terms

      Delete
    4. cls
      a = 4
      b = 4
      for i = 1 to 8
      print a;
      print b;
      a = a + b
      b = a + b
      next i
      End

      Delete
  2. Pls give patterns of string pyramids

    ReplyDelete
  3. How to print numerator and denominator in qbasic

    ReplyDelete
  4. To input two num and find the biggest num using while loop.

    ReplyDelete
  5. c
    co
    com
    comp
    compu
    comput
    compute
    computer
    without using mid$

    ReplyDelete
    Replies
    1. cls
      a$="computer"
      for j=1 to len(a$)
      print left$(a$,j)
      next j
      end

      Delete
    2. CLS
      L=LEN("COMPUTER")
      FOR J=1 TO L
      PRINT LEFT$("COMPUTER";J)
      NEXT J
      END

      Delete
    3. Hi! This is Pratyush. I am in the 8th grade aand this was really helpful. Thank you!

      Delete
    4. cls
      let A$="computer"
      for I = 1 to Len(A$)
      print left$(A$,I)
      next I
      end

      Delete
    5. Cls
      a$ = "computer"
      For x = 1 To Len(a$)
      Print Left$(a$, x)
      Next x
      End

      Delete
  6. c
    co
    com
    comp
    compu
    comput
    compute
    computer
    without using mid$

    ReplyDelete
    Replies
    1. cls
      a$="computer"
      for i = 1 to 8
      print left$(a$,i)
      next i
      end

      Delete
    2. cls
      print;c
      print;co
      print;com
      print;comp
      print;compu
      print;comput
      print;compute
      print;computer
      hahhaaaahhaa

      Delete
    3. Pattern
      C
      Co
      Com
      Comp
      Compu
      Comput
      Compute
      Computer :using mid $
      Cls
      A$="Computer"
      D=len(a$)
      For I = 1 to d
      For j = 1 to I
      Print mid$(a$,j,1);
      Next j
      Print
      Next I
      End

      Delete
  7. c
    co
    com
    comp
    compu
    comput
    compute
    computer

    ReplyDelete
  8. Cls
    a$ = "computer"
    for p=1 to LEN(a$)
    print left$(a$,p)
    next p
    end

    ReplyDelete
  9. print the series of .1,.03,..5,.0007,.00009

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. CLS
      B = .1
      FOR P = 1 TO 10 STEP 2
      A = P/B
      PRINT A;
      B = B*10
      NEXT P
      END

      Delete
    3. CLS
      B = .1
      FOR P = 1 TO 10 STEP 2
      A = P/B
      PRINT A;
      B = B*10
      NEXT P
      END

      Delete
    4. CLS
      B = 1
      FOR P = 1 TO 10 STEP 2
      A = P/B
      PRINT A;
      B = B*10
      NEXT P
      END

      Delete
    5. Sagar sapkota g thanks.use rem keyword it is help to find the program.

      Delete
    6. Sagar sapkota g thanks.use rem keyword it is help to find the program.

      Delete
  10. Rem a program to find area of circle
    CLS
    INPUT "ENTER THE RADIUS OF CIRCLE"; R
    CONST PI = 22/7
    A = PI*R^2
    PRINT "AREA OF CIRCLE ="; A
    END

    ReplyDelete
  11. Wap to write a program to print all the magic nos within the range 1 to 500

    ReplyDelete
  12. Replies
    1. REM 1/ 2 + 1 / 3 + 1 / 4 . . . . .
      CLS
      S = 0
      INPUT " ENTER THE VALUE FOR LOOP : "; N
      FOR I = 1 TO N
      K = 1 / (I + 1)
      PRINT K;
      S = S + I / (I + 1)

      NEXT I
      PRINT " SUM OF THE SERIES IS : "; S

      Delete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Program that prints several stars in the form of nepalese flag..

    ReplyDelete
    Replies
    1. CLS
      S$ = "****"
      FOR I = 1 TO LEN(S$)
      PRINT LEFT$(S$, I)
      NEXT I

      FOR J = 1 TO LEN(S$)
      PRINT LEFT$(S$, I)
      NEXT J

      FOR K = 1 TO LEN(S$)
      PRINT MID$(S$, K, 1)
      NEXT K

      END

      Delete
    2. CLS
      S$ = "****"
      FOR I = 1 TO LEN(S$)
      PRINT LEFT$(S$, I)
      NEXT I
      FOR J = 1 TO LEN(S$)
      PRINT LEFT$(S$, I)
      NEXT J
      FOR K = 1 TO LEN(S$)
      PRINT MID$(S$, K, 1)
      NEXT K
      END

      Delete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Can u help me with this. How to print 1,.3,.05,.007,.0009 seris in qbasic programming.

    ReplyDelete
  17. Can u help me with this. How to print 1,.3,.05,.007,.0009 seris in qbasic programming.

    ReplyDelete
  18. Can u help me with this. How to print 1,.3,.05,.007,.0009 seris in qbasic programming.

    ReplyDelete
    Replies
    1. cls
      b=10
      for i= 1 to 10 step 2
      A= i/b
      print A;
      Next i
      end

      Delete
    2. with your program the output will be as:
      .1, .3, .5, .7 , .8
      It doesn't generate 1,.3,.05,.007,.0009 this pattern!

      Delete
    3. Cls
      b = 10
      For i = 1 To 10 Step 2
      A = i / b
      Print A;
      b = b * 10
      Next i
      End

      Delete
  19. How to reverse the digits of a given number

    ReplyDelete
  20. HOW TO DISPLAY THE FOLLOWING PATTERN IN QBASIC:
    B
    AA
    SSS
    IIII
    CCCCC

    pls help me!!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. DIM N$(5)
      FOR I = 1 TO 5
      READ N$(I)
      NEXT I
      DATA "B","A","S","I","C"
      FOR P = 1 TO 5
      FOR J = 1 TO P
      PRINT N$(P);
      NEXT J
      PRINT
      NEXT P
      END

      Delete
  21. can you all please help me???????

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Write a programme in q basic to display greatest and lowest of 20 numbers without using loop.

    ReplyDelete
  24. WAP to generate number series. 3,6,9...Up to 15 terms

    ReplyDelete
    Replies
    1. so easy..........
      CLS
      n=15
      FOR I=3 TO n STEP 3
      NEXT I
      PRINT I
      END.

      Delete
    2. cls
      for i = 3 to 45 step 3
      print i ;
      next
      end

      Delete
  25. How to display the given pattern:

    M
    HMA
    THMAN
    ATHMAND
    KATHMANDU

    ReplyDelete
  26. Replies
    1. CLS
      a = 0
      INPUT "Enter any number", n
      FOR i = 2 TO n
      IF i MOD 2 = 0 THEN
      a = a + i
      PRINT a,
      END IF
      NEXT
      END

      Delete
  27. 543212345
    4321234
    32123
    212
    1
    Any please help for this program

    ReplyDelete
  28. how to print ::
    computer
    ompute
    mput
    pu
    u

    ReplyDelete
  29. display the series 1,2,4,7,11...15th term
    can you solve this???? challenge :p

    ReplyDelete
    Replies
    1. CLS
      A=1
      FOR I=1 TO 15
      PRINT A;
      A=A + I
      NEXT
      END

      Delete
    2. cls
      a=1
      for i = 1 to 15
      print a;
      a=a+i
      next
      end
      challenge completed****

      Delete
  30. WAP to generate multiples of a table of a given number

    ReplyDelete
    Replies
    1. INPUT "ENTER A NUMBER";N
      CALL TABLE(N)

      SUB TABLE(X)
      FOR I=1 TO 10
      PRINT X;"X";I;"=";I*X
      NEXT I
      END SUB

      Delete
  31. using a FOR-Next statement, write a QBASIC program to comput and display the summation and multiplication of the numbers from 1 to 50

    ReplyDelete
  32. please solve a problem for me too
    print the sum of the series
    1/2+2/3+3/4+4/5+5/6.........

    ReplyDelete
  33. This comment has been removed by the author.

    ReplyDelete
  34. 1 2 3 4 5
    2 4 6 8 10
    3 6 9 12 15
    4 8 12 16 20
    5 10 15 20 25

    ReplyDelete
    Replies
    1. Can you please help me out with this program

      Delete
    2. FOR I=1 TO 5
      FOR J=1 TO 5
      PRINT I*J;
      NEXT J
      PRINT
      NEXT I

      Delete
    3. CLS
      a = 1
      FOR i = 1 TO 5
      FOR j = 1 TO 5
      PRINT a,
      a = a + i
      NEXT j
      a = i + 1
      NEXT i

      Delete
  35. print(sgn(val( 24.5 )))
    can anyone tell me the output?

    ReplyDelete
  36. write a program in qbasic to input integer number and after input any digit check whether the digit is exist or not exist in the number through while loop

    ReplyDelete
    Replies
    1. INPUT "ENTER NUMBER"; N
      INPUT "ENTER DIGIT"; A
      TOP:
      WHILE A <> 0
      R = A MOD 10
      A = A \ 10
      IF R = N THEN
      F = 1
      END IF
      WEND
      IF F = 0 THEN
      PRINT "NUMBER DOESNOT EXITS"
      ELSE
      PRINT "NUMBER EXISTS"
      END IF

      END

      Delete
  37. find the sum of 12 terms of the series 7+11+15+...hence,the first term a=7,common difference d=4 and number of terms n=12 please help solve it

    ReplyDelete
  38. Write a program asking the user to input his/her first name and last name. Concatenate the two strings and display the first name followed by the last name.

    ReplyDelete
    Replies
    1. CLS
      REM program to display name
      FIRSTNAME$ "DGREATYOUNGSTAR"
      LASTNAME$ "EUPHEMIA"
      PRINT FIRSTNAME$
      PRINT LASTNAME$
      NEXT
      END

      Delete
  39. write a qbasic program to generate 43, 31, 29, ...... 1

    ReplyDelete
  40. please, I need a program to find a transpose of a matrix

    ReplyDelete
  41. Write a program to guess number game.
    CLS
    REM program to guess number
    INPUT X
    IF(X<>20)
    THEN
    PRINT "YOU GUESS RIGHT"
    ELSE
    PRINT "WRONG GUESS"
    END IF
    END

    ReplyDelete
  42. WAP to print the following series
    11,3,14,17,31, .............. up to 18th terms

    ReplyDelete
  43. can you help me to solve this question..
    write a program to display the greatest number among the number in the list. The list contsins 45, 65, 12, 68, 87, 122 and 450

    ReplyDelete
  44. Can you solve this challenge
    1
    11
    121
    1321
    Print this series by using for loops

    ReplyDelete
  45. SOLUTION FOR GENERATING FOLLOWING PATTERN
    N
    EPA
    NEPAL

    ReplyDelete
  46. Solve this
    HAPPY
    APPY
    P

    ReplyDelete
  47. how to print pattern
    1 1
    12 3
    123 6
    1234 10

    ReplyDelete
  48. L
    AL
    PAL
    EPAL
    NEPAL
    How to print pattern

    ReplyDelete
  49. L
    AL
    PAL
    EPAL
    NEPAL
    How to print pattern

    ReplyDelete
  50. M
    HMA
    THMAN
    ATHMAND
    KATHMANDU
    write a program to print this pattern

    ReplyDelete
  51. Please I need a solution on how to find the transpose of a given matrix 1 3 5
    4 -2 4
    7 3 2

    ReplyDelete
  52. Please I need a solution on how to find the transpose of a given matrix
    1 3 5
    4 -2 4
    7 3 2

    ReplyDelete
  53. Please I need solution about number series 5 10 20 35 55 80 110 .. .. . 10th term.

    ReplyDelete
  54. Please can you help me with this programming input of QBASIC.Find all the prime numbers from 0 to 99

    ReplyDelete
  55. Wap to convert days into respective years months days

    ReplyDelete
  56. @@@@@
    @@@@
    @@@
    @@
    @
    Please let me know how to print this pattern

    ReplyDelete
  57. $
    $ $ $
    $ $ $ $ $
    $ $ $
    $
    Please help me with the code to print this pattern too. Thanks.

    ReplyDelete
  58. 1 2 3 4 5
    2 3 4 5 6
    3 4 5 6 7
    4 5 6 7 8
    5 6 7 8 9
    Please let me know the program to print this. Thanks.

    ReplyDelete
  59. Print the series using loop 5 10 15 12 25 30

    ReplyDelete
  60. WAP THAT ACCEPT DECIMAL NO.and CONVERT INTO OCTAL REPERSENTATION.

    ReplyDelete
  61. Can any one program this ...WAP to find greatest among 'n' different numbers...please!

    ReplyDelete
  62. Pls write the qbasic coding to print the numbers 24;99;224;399

    ReplyDelete
  63. Plzz write question when you Answer the question given.by people's in the comment box

    ReplyDelete
  64. 2 4 6 8 10
    4 6 8 10
    6 8 10
    8 10
    10

    ReplyDelete
  65. Can you help me to input rollno,name,class,section and marks of 8 different subject of 20 students of your class using array(dim) in qbasic

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

    ReplyDelete
  67. write Q BASIC program to print series 7,10,13,16....49

    ReplyDelete
  68. program for
    KATHMANDU
    ATHMAND
    THMAN
    HMA
    M

    ReplyDelete
  69. output to print the factors of 6.

    ReplyDelete
  70. PRINT THE SERIES 1,4,7,10...25 BY FOR NEXT LOOP

    ReplyDelete
  71. WAP to find the smaller of two numbers and then print its square by using
    if-then-else statement.

    ReplyDelete
  72. WAP to display the following programs in QBasic:

    (i) 1
    1 1
    1 2 1
    1 3 3 1

    (ii)1 2 3
    2 3
    3
    please reply as soon as possible

    ReplyDelete
  73. King of Casinos - Shootercasino
    King of Casinos King of Casinos is the name for a casino game of 인카지노 chance. In King 제왕 카지노 of Casinos, you must choose one of four lucky 카지노 people you know.

    ReplyDelete