Qbasic Programs
- WAP to find the area of rectangle.
INPUT "ENTER LENGTH" ; L
INPUT "ENTER BREADTH" ; B
AREA = L * B
PRINT "AREA OF RECTANGLE IS=" ; AREA
END
2. WAP to display the area of circle.
=)CLS
INPUT "ENTER RADIUS " ; R
A = 22/7^2
PRINT "AREA OF CIRCLE" ; A
END
3. WAP to find the area of square.
=)CLS
INPUT "ENTER LENGTH" ; L
A = L^2
PRINT "AREA OF SQUARE=" ; A
END
4. WAP to find the area of triangle.
=)CLS
INPUT "ENTER BASE" ; B
INPUT "ENTER HEIGHT" ; H
A = 1/2*B*H
PRINT "AREA OF TRIANGLE=" ;A
END
5. WAP to find the volume of cylinder.
=)CLS
INPUT "ENTER RADIUS" ; R
INPUT "ENTER HEIGHT" ; H
V = 22/7 * R ^ 2 * H
PRINT " VOLUME OF CYLINDER =" ; V
END
6. WAP to input percentage and display pass or fail.
=)CLS
INPUT "ENTER PERCENTAGE" ; P
IF P > = 40 THEN
PRINT "PASS"
ELSE
PRINT "FAIL"
END IF
END
7. WAP to input any number and check odd or even.
=)CLS
INPUT "ENTER ANY NUMBER" ; N
IF N MOD 2 = 0 THEN
PRINT "EVEN NUMBER "
ELSE
PRINT "ODD NUMBER "
END IF
END
8. WAP to input any number and check positive, negative or zero.
=)CLS
INPUT "ENTER ANY NUMBER" ; N
IF N > 0 THEN
PRINT "POSITIVE NUMBER "
ELSEIF N < 0 THEN
PRINT "NEGATIVE NUMBER "
ELSE
PRINT "ZERO"
END IF
END
9. WAP to input any number and check whether it is divisible by 5 or not.
=)CLS
INPUT "ENTER ANY NUMBER" ;
IF N MOD 5 = 0 THEN
PRINT "THE NUMBER IS DIVISIBLE BY 5"
ELSE
PRINT "THE NUMBER IS NOT DIVISIBLE BY 5"
END IF
END
10. WAP to dislplay 5,10,15,.........,50.
=)CLS
FOR I = 5 TO 50 STEP 5
PRINT I
NEXT I
END
11. WAP to display 100,90,80,.....,10.
=)CLS
I = 100
WHILE I > = 10
PRINT I
I = I - 10
WEND
END
12. WAP to display 2,4,6,8,....20.
=)CLS
I = 2
DO WHILE I < = 20
PRINT I
I = I + 2
LOOP
END
13. WAP to display 50,45,40,.....,5.
=)CLS
I = 50
WHILE I > = 5
PRINT I
I = I - 5
WEND
END