Wednesday, November 16, 2011

Some QBASIC programs

QuickBasic is a programming language developed by Microsoft for use in the MS-DOS operating system. It is the successor of earlier forms of BASIC (Beginners All-Purpose Symbolic Instruction Code), a simple programming language for beginning programmers. QB is an ideal programming language for beginners because of its intuitive commands, simple structure and flexibility. It is well-documented, and hundreds of tutorials and sample programs are available for download on the Internet.
If you don have a Qbasic in your computer, you can download it right here .
Recently we got a project work in our school regarding Qbasic. We had to write some Qbasic programs. Here are some  of the Qbasic programs we had to write..

                   QBASIC PROGRAMS


  • A PROGRAM TO CHECK WHETHER AN INPUT NUMBER IS ARMSTRONG OR NOT.

DECLARE SUB ABC ( )
CLS
CALL ABC
END
SUB ABC ( )
INPUT “Enter a number"; n 
S = N 
WHILE N <> 0 
A = N MOD 10 
R =R + A ^ 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

REMARK: - IT IS CORRECT...

  • A PROGRAM TO CHECK WHETHER AN INPUT NUMBER IS PALINDROME OR NOT.

    DECLARE SUB PALIN ( )
   CLS
   CALL PALIN
   END
   SUB PALIN ( )
   INPUT "ENTER ANY NUMBER"; N
   S=N
   WHILE N<>0
   R=N MOD 10
   D=D*10+R
   N=N\10
   WEND
   IF D=S THEN
   PRINT "IT IS A PALINDROME"
   ELSE
   PRINT "IT IS NOT A PALINDROME"
   END IF
   END SUB

REMARK: - IT IS CORRECT...





  • A PROGRAM TO CHECK WHETHER AN INPUT STRING IS CAPITAL OR SMALL.

     DECLARE SUB XYZ ( )
    CLS
    CALL XYZ
    END
    SUB XYZ ( )
    INPUT "ENTER ANY ALPHABET"; A$
   C$=UCASE$ (A$)
   IF C$=A$ THEN
   PRINT "THE LETTER IS CAPITAL"
   ELSE
   PRINT "THE LETTER IS SMALL"
   END IF
   END SUB

REMARK: - IT IS CORRECT...


  • A PROGRAM TO PRINT FIBONACCI SERIES.

   DECLARE SUB ABC ( )
   CLS
   CALL ABC
   END
   SUB ABC ( )
   A=1
   B=1
   PRINT A;
   PRINT B;
   C=3
   WHILE C<=70
   C=A+B
   PRINT C;
   A=B
   B=C
   C=C+1
   WEND
   END SUB

 REMARK: - IT IS CORRECT...
                                                                                                     







  • A PROGRAM TO CHECK WHETHER AN NUMBER IS PRIME OR COMPOSITE

    DECLARE SUB SET ( )
   CLS
   CALL SET
   END
   SUB SET ( )
   INPUT "ENTER ANY NUMBER"; A
   FOR I=2 TO A/2
   IF A MOD I=0 THEN
   C= C+2
   END IF
   NEXT I
   IF C>0 THEN
   PRINT "THE NUMBER IS COMPOSITE"
   ELSE
   PRINT "THE NUMBER IS PRIME"
   END IF
   END SUB

REMARK: - IT IS CORRECT...




















                                                                                      http://www.blogofbibek.blogspot.com

5 comments:

  1. ya bibek you are really great

    ReplyDelete
  2. u doing a great job.. keep posting these kinda stuff... will help your frenz alot.. nice nice..!!

    ReplyDelete
  3. Hi please help me to solved this question....
    write an algorithm and draw a flow chart to generate multiple tables of a given number upto N magnitude.

    ReplyDelete
  4. WAP ro input string than check it is palindrome or not

    ReplyDelete