Saturday, June 23, 2018

QBASIC

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

CLS

INPUT "enter any number";n

IF n MOD 3=0 AND n MOD 7=0

PRINT "number is divisible by 3 and 7"

ELSE

PRINT "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.

CLS

INPUT "ENTER ANY NUMBER";N

IF N > 0 THEN

PRINT "THE NUMBER ISPOSITIVE"

ELSE IF N < 0 THEN

PRINT "THE NUMBER IS NEGATIVE"

END IF

END

 

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

CLS

INPUT "ENTER ANY NUMBER";N

IF N MOD 2 = 0 THEN

PRINT "THE EVEN NUMBER"

ELSE

PRINT "THE ODD NUMBER"

END IF

END

 

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

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.

CLS

INPUT "ENTER ANY THREE NUMBER"; S, U, M

IF S > U AND S < M OR S < U AND A > M THEN

PRINT "THE MIDDLE NUMBER IS";S

ELSE IF U > S AND U < M OR U < S AND U > M THEN

PRINT "THE MIDDLE NUMBER IS";U

ELSE

PRINT "THE MIDDLE NUMBER IS";M

END IF

END

 

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

CLS

INPUT "ENTER ANY NUMBER";N

IF N MOD 13 = 0 THEN

PRINT "THE NUMBER IS COMPLETELY DIVISIBLY BY 13"

ELSE

PRINT "THE NUMBER IS NOT COMPLETELY DIVISIBLE BY 13"

END IF

END

 

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

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 "NUMBER IS ZERO"

END IF

END

 

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

CLS

INPUT "ENTER YEAR";Y

IF Y MOD 4 = 0 AND Y MOD 100 < > 0 OR Y MOD 400 = 0 THEN

PRINT "THE GIVEN YEAR IS NOT LEAP YEAR"

ELSE

PRINT "THE GIVEN YEAR IS NOT LEAP YEAR"

END IF

END

 

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

CLS

INPUT "ENTER YOUR AGE";A

IF A > 16 THEN

PRINT "YOUR ARE ELIGIBLE TO VOTE"

ELSE

PRINT "YOUR ARE NOT ELIGIBLE TO VOTE"

END IF

END

 

10)WAP to enter any three numbers and display the greatest one using sub procedure.

CLS

INPUT "ENTER THREE NUMBER"; A, B, C

IS A > B AND A > C THEN

PRINT "The greatest number is"; A

ELSE IF N > A AND N > T

PRINT "The greatest number is"; B

ELSE

PRINT " The greatest number is"; C

END IF

END

My Journey with JM

MY JOURNEY WITH JAGAT MANDIR It has been almost 10 years since I have entered this school. It seems like just yesterday but now I...