Qbasic Programs
1) Write a program to find the area of rectangular
CLS
INPUT '' Enter Length'';L
INPUT ''Enter breadth'';B
A=L*B
PRINT '' AREA OF RECTANGULAR'':A
END
2) Write a program to display area of circle
CLS
INPUT ''Enter radius ''; R
A=22/7*R^2
PRINT''Area of circle'';A
END
3) Write a program to find a area of square
CLS
INPUT ''Enter Length '';L
A=L^2
PRINT''Area of Square ''; A
END
4) Write a program to find volume of cylinder
CLS
INPUT ''Enter Radius'';R
INPUT ''Enter Height'';H
A = 22/7*R^2*H
PRINT''Volume of cylinder'';V
END
5) Write a program to find input percentage and display pass and fail
CLS
INPUT ''Enter percentage'';P
IF P>=40 THEN
PRINT ''You are Pass''
ELSE
PRINT ''You are Fail''
END IF
END
6) Write a program to find 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
7)Write a program to find input any number 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
8.Write a program to find a area of triangle
CLS
INPUT ''Enter base''b
INPUT ''Enter height'';h
A=1/2*b*h
PRINT''Area of triangle '';A
END
9) Write a program to find input any number whether it is divisible by 5 or not
CLS
INPUT '' Enter any number '';N
IF N MOD 5=0 THEN
PRINT ''The number indivisible by 5''
ELSE
PRINT '' The number is not divisible by 5''
END IF
END
10) Write a program to display 5,10,15................50
CLS
FOR I = 5 TO 50 STEP 5
PRINT I
NEXT I
END
11) Write a program to display 100 ,90,80.........10
CLS
FOR I = 5 TO 50 STEP - 10
PRINT I
NEXT I
END
12)Write a program to display 2 ,4,6.........20
CLS
FOR I = 2 TO 20 STEP 2
PRINT I
NEXT I
END
13)Write a program to display 50,45,40.......5
CLS
FOR I = 50 TO 5 STEP - 5
PRINT I
NEXT I
END IF
END
14)Write a program to find product and difference of any two constant number.
CLS
LET A= 50
LET B= 60
P= A*B
D= A-B
PRINT "Product of two number=";A
PRINT "Difference of two number=";D
END
15)Write a program that asks the length of a board in feet and calculate its equivalent length in inches.
CLS
INPUT "Enter length in feet";F
I = F*12
PRINT "Length in inches=";I
END