QBASIC PROJECT WORK

 1. WAP to input number and check whether the given no. is divisible by 3 and 7 or not.

Ans:
          CLS
          INPUT  "Enter any number";n
          IF  n  MOD  3 =0  AND  n  MOD  7=0 THEN
          PRINT  "The number is divisible by 3 and 7"
          ELSE  
          PRINT  "The given number is not divisible by 3 and 7"
          END IF
          END





2. WAP to input any number and check whether the given no.is positive or negative. 

Ans:
          CLS 
          INPUT  "Enter any number";n

          IF n>0 THEN
          PRINT  "the given number is positive"
          ELSEIF n=0 THEN
          PRINT  "the given number is zero"
          ELSE
          PRINT  "the given number is negative"
          END IF
          END



3. WAP to input any number and display whether it is odd or even. 

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


4. WAP to enter any two number and display the smaller one . 

Ans:
          CLS 
          INPUT  "Enter any two number";A,B 
          IF  A < B  THEN 
          PRINT  "The smallest number is";A 
          ELSE 
          PRINT  "The smallest number is";B 
          END IF 
          END 


5. WAP to enter any three numbers and display the middle number. 

Ans:
          CLS 
          INPUT  "Enter any three number"; A,B,C
          IF A > B AND A < C OR  A< B AND A > C THEN 
          PRINT  "The middle number is"; A
          ELSE IF B > A  AND B < C OR B < A  AND B > C THEN 
          PRINT  "The middle number is"; B
          ELSE 
          PRINT  "The middle number"; C
          END IF 
          END 


6. WAP to test weather a user input number is completely divisible by 13 or not. 

Ans:
           CLS 
           INPUT  "Enter any number";N 
           IF  N  MOD  13 = 0  THEN 
           PRINT  "The number is divisible by 13" 
           ELSE 
           PRINT  "The number is not divisible by 13" 
           END IF 
           END 


7. WAP to define a function procedure which return whether a input number is positive, negative, zero. 

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


8. WAP to input a year and display whether the year is leap year or not. 

Ans:
          CLS 

          INPUT  "Enter your year";Y 
          IF  Y  MOD  4 = 0  AND  Y  MOD  100 < > 0  OR  Y  MOD  400 = 0  THEN 
          PRINT  "The year is a leap year" 
          ELSE 
          PRINT "The year is not a leap year" 
          END IF 
          END 


9. Input the age of a person and find out whether the person is eligible to drive or not. 

Ans:
          CLS 
          INPUT  "Enter your age";A 
          IF  A > 16  THEN 
          PRINT  "You are eligible to vote" 
          ELSE 
          PRINT  "You are not eligible to vote" 
          END IF 
          END 


10. WAP to enter any three numbers and display the greatest one.

Ans:
          CLS 
          INPUT  "Enter any three number"; A,B,C
          IS A > B AND A > C THEN 
          PRINT  "The greatest number is";A 
          ELSE  IF B > A AND B > C
          PRINT  "The greatest number is";B 
          ELSE 
          PRINT  "The greatest number is ";C
          END IF 
          END

Comments

Popular posts from this blog

Father's day

Journey to jm

My Father