Saturday, August 9, 2014

QBASIC PROGRAMMING

project 

                              of computer

                                      on

                        Qbasic programming




(1)WAP to input any number and check whether the given number is divisible by 5 or not.



REM
CLS
INPUT"Enter any number";N
IF N MOD 5 =0 THEN
PRINT"The number s divisible by 5"
ELSE
PRINT "The number is not divisible by 5"
END


(2)WAP to input any number and check whether the given number is divisible by 3 and 7 or not.


REM
CLS
INPUT"Enter any number";N
IF N MOD 3=0  AND N MOD 7=0 THEN 
PRINT"The number is completely divisible by 3 and 7"
ELSE 
PRINT"The number is completely not divisible by 3 and 7"
END


(3)WAP to check whether the number is odd or even.



REM
CLS
INPUT"Enter any number";N
IF N MOD 2=0 THEN
PRINT"The number is even"
ELSE
PRINT"The number is odd"
END


(4)WAP to check whether the number is positive negative or zero.



REM
CLS
INPUT"Enter any number";N
IF N>0 THEN
PRINT"The number is positive"
ELSEIF N<0 THEN
PRINT"The number is negative"
ELSE
PRINT"The number is zero"
END IF 
END



(5)WAP to input marks of a student in a subject and check whether he is pass or not.


REM
CLS
INPUT"Enter marks in a subject";M
IF M>=40 THEN 
PRINT"You are pass"
ELSE
PRINT"You are fail"
END IF
END



(6)WAP to enter any two number and display the greater one.



REM

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


(7)WAP  to enter any three number and display the greater one.


REM
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 GREATEST"
ELSEIF B>A AND B>C THEN
PRINT B;"IS GREATEST"
ELSE
PRINT C;"IS GREATEST"
END IF 
END


(8)WAP to display all natural numbers from 1 to 100.(use for.....next, while........wend, do while......loop,do ......loop while, do until......loop,do.........loop until)




(FOR...... NEXT)                          

REM    
CLS         
 FOR I=1 TO 100                           
PRINT I,   
NEXT I                                          
END                                                           
    

           

(WHILE.........WEND)                                                      


REM                                                        
CLS                                                      
I=1
WHILE I<=100
PRINT I,
I=I+1                                                                     
WEND
END


(DO WHILE........LOOP)
                
REM     
CLS                                                
I=1           
DO WHILE I<=100  
PRINT I,                                        
I=I+1                                            
LOOP      
END       
                                  
                                         
(DO.........LOOP WHILE)

REMCLS
I=1
DO
PRINT I,
I=I+1
LOOP WHILE I<=100
END



(DO UNTIL.........LOOP)

REM
CLS
I=1
DO UNTIL I>100
PRINT I,
I=I+1
LOOP
END



(DO......LOOP UNTIL)

REM
C LS
I=1
DO
PRINT I,
I=I+1
LOOP UNTIL I>100
END



(9)WAP to display 10,20,30,........100(use for.....next, while........wend, do while......loop,do ......loop while, do until......loop,do.........loop until)


(FOR.......NEXT)       
                       
REM        
CLS
FOR I=10 TO 100 STEP 10               
PRINT I,                                             
NEXT I                                              
END   

                                 
                                                 
 (WHILE.......WEND) 

 REM  
 CLS
 I=10                                                  
WHILE I<=100
PRINT I,
I=I+10
WEND                                                          
END


(DO WHILE.....LOOP) 

REM

CLS
I=10
DO WHILE I<=100
PRINT I,
I=I+10
LOOP 
END




(DO.......LOOP WHILE)

REM
CLS
I=10
DO 
PRINT I,
I=I+10
LOOP WHILE I<=100
END




(DO UNTIL......LOOP)

REM
CLS
I=10
DO UNTIL I>100
PRINT I,
I=I+10
LOOP
END




(DO........LOOP UNTIL)

REM
CLS
I=10
DO 
PRINT I,
I=I+10
LOOP UNTIL I>100
END


(10)WAP TO DISPLAY ALL EVEN NUMBERS FROM 50 TO 1.



(FOR.....NEXT)


REM
CLS
FOR I=50 TO 1 STEP -2
PRINT I,
NEXT I
END




(WHILE........WEND)

REM
CLS
I=50
WHILE I>=1
PRINT I,
I=I-2
WEND
END



(DO WHILE.......LOOP)

REM
CLS
I=50
DO WHILE I>=1
PRINT I,
I=I-2
LOOP
END



(DO......LOOP WHILE)

REM
CLS
I=50
DO
PRINT I,
I=I-2
LOOP WHILE I>=1
END



(DO UNTIL......LOOP)

REM
CLS
I=50
DO UNTIL I<1
PRINT I,
I=I-2
LOOP
END

(DO.......LOOP UNTIL)


REM
CLS
I=50
DO
PRINT I,
I=I-2
LOOP UNTIL I<1
END