Friday, June 24, 2016


"QBASIC PROGRAMING"

1). CALCULATE AREA OF RECTANGLE.

CLS
INPUT "ENTER LENGTH";L
INPUT "ENTER BREADTH";B
A= L*B
PRINT "AREA OF RECTANGLE=";A
END


2).CALCULATE AREA OF SQUARE.

CLS
INPUT "ENTER LENGTH";L
A=L^2
PRINT "AREA OF SQUARE=";A
END




3).CALCULATE ARE OF CIRCLE.

CLS 
INPUT "ENTER RADIUS";R
A=22/7 *R^2
PRINT "AREA OF CIRCLE=";A
END


4).CALCULATE AREA OF TRIANGLE.

CLS
INPUT "ENTER BASE ";B
INPUT "ENTER HEIGHT";H
A=1/2*B*H
PRINT "AREA OF TRIANGLE= ";A
END


5).CHECK WHETHER THE GIVEN NUMBER IS ODD OR EVEN.

CLS
INPUT "ENTER ANY NUMB ER ";N
IF N MOD <=0 THEN
PRINT "THE GIVEN NUMBER IS EVEN"
ELSE
PRINT "THE GIVEN NUMBER IS ODD" 
END IF
END


6).CONVERT DOLLAR INTO NEPALESE CURRENCY.

CLS
INPUT "ENTER DOLLAR";D
N=D*100
PRINT "NEPALESE CURRENCY VALUES=";N
END


7).check whether the given number is positive ,negative or zero.

CLS
Input "enter any number ";N
IF N>o THEN
PRINT "The given number is positive"
ELSE IF N <0 THEN
PRINT "The given number is negative"
ELSE
PRINT "the given number is zero" 
END IF 
END

8).Input name and percentage and display the division along with name and percentage.

CLS
INPUT "enter name";N$
INPUT "enter percentage"P
SELECT CASE P
CASE 80 TO 100
d$= "distinction"
CASE 60 to 79.9
CASE 50 to 59.9
d$ = "second division"
CASE 40 to 49.9
d$="third division"
CASE is <40
d$= "failed" 
CASE ELSE
PRINT "wrong entry"
END SELECT 
PRINT "name","percentage","division"
PRINT N$,P,D$
END


9).convert minutes into hours and minutes.

CLS
INPUT "enter minute";M
H=M\60
MIN = M MOD 60
PRINT "Hours=";H
PRINT "Minutes=";M
END

10).check whether the given number is divisible by 3 and 7 or not.

CLS
INPUT "enter any number ";N
IF N MOD 3=0 AND N MOD 7= 0 THEN PRINT "The given number is divisible by 3 and 7"
PRINT "the given number is not divisible by 3 and 7" END IF 
END

11).convert temperature in degree centigrade into Fehrenheit

CLS 
INPUT "enter degree celsius";C
F= (9*c /5)+32
PRINT "fahrenheit =";F
END


12).input any three numbers and display the smallest one.

CLS
INPUT "enter first number";A
INPUT "enter second number";B
INPUT "enter  third number";
IF A-B <0 then
PRINT "A IS smallest =";A
ELSE IF
PRINT "B IS smallest =";B
ELSE
PRINT "C IS smallest=";C
END IF
END

13).convert Indian currency into Nepalese currency.

CLS
INPUT "enter Indian";D
D*1,6
PRINT "Nepalese currency value=";N
END

14).