qbasic programs....



Q BASIC PROGRAMS
1)WAP to check whether the given no. is divisible by 3 and 7 or not.
CLS
INPUT"enter a number";N
if N MOD 3=0  AND N MOD 7=0 THEN
PRINT"the given no. is divisible by 3 and 7"
ELSE
PRINT"the given no. i9s not divisible by 3 and 7"
END IF
END

2)WAP to check whether the given no. is positive or negative.
CLS
INPUT "enter a number";N
IF N>0 THEN
PRINT"the given no. is positive "
ELSE
PRINT"the given no. is negative"
END IF
END

3)WAP to check whether the given no. is odd or even.
CLS
INPUT"enter a number";N
IF N MOD 2=0 THEN
PRINT"the given no. is even"
ELSE
PRINT"the given no. is odd"
END IF 
END

4)WAP to display two input smallest number.
CLS
INPUT" enter two number";A,B
IF A<B THEN
PRINT"the smaller no. is";A
ELSEIF B<A THEN
PRINT"the smaller no. is";B
END IF
END

5)WAP to display middle no. among three numbers.
CLS
INPUT"enter three number";A,B,C
IF A>>B AND A<C OR A<B AND A>C THEN
PRINT"the middle no. is";A
ELSEIF B>A AND B<C OR B<A AND B>C THEN
PRINT"thew middle no. is";B
ELSE
PRINT"the middle no. is";C
END IF 
END

6)WAP to check whether the given no. is divisible by 13 or not.
CLS
INPUT"enter a number";N
IF N MOD 13=0 THEN
PRINT"the given no. is divisible by 13"
ELSE
PRINT"the given no. is not divisible by 13"
END IF
END

7)WAP to check whether the given no. is positive, negative or zero.
CLS
INPUT"enter a number";N
IF N>0 THEN
PRINT"the given no. is positive"
ELSEIF N<0 THEN
PRINT"the given no. is negative"
ELSE
PRINT"the given no. is zero"
END IF
END

8)WAP to check whether the given the year is leap year or not.
CLS
INPUT"enter a year";Y
IF Y MOD 4=0 AND Y MOD 100<>0 OR Y MOD 400 =0 THEN
PRINT"the given year is leap year"
ELSE
PRINT"the given year is not a leap year"
END IF
END

9)WAP to check whether the person around(A>=16)is eligible to drive or not.
CLS
INPUT"Enter your age";A
IF A>=16 THEN
PRINT"you are eligible to vote" 
ELSE
PRINT"you are not eligible to drive"
END IF
END

10)WAP to display the greatest number among three number.
CLS
INPUT"Enter three number";A,B,C
IF A>B AND A>C THEN
PRINT"the greatest no. is";A
ELSEIF B>A AND B>C THEN
PRINT"the greatest no. is";B
ELSE
PRINT"the given no. is ";C
END IF
END

Comments