Friday, June 17, 2011

Qbasic Examples

lab1.
REM “My first QBASIC program”
REM “The sales tax on an article is 25% of its price.”
REM “This program finds the sales tax on an article”
LET price =200
LET tax =price*25/100
PRINT “The sales tax is::”; tax
END

Lab2
CLS
REM “This program finds the area of a circle”
PI=3.14159
LET R=8
Area =PI*(R^2)
PRINT “The area is:::”; Area
END

lab 3.
CLS
Rate = 50
Pas = 20
Total = Pas*rate
PRINT “The total amount is=”; Total
END

Lab4
REM “This program finds the area of a rectangle”
CLS
INPUT “Enter the length of a rectangle”; l
INPUT “Enter the width of a rectangle”; w
Area= l*b
PRINT “The area of the rectangle is:::”; Area
END

Lab5.
X = 1
Top :
Y = x*x
PRINT y
X=x+1
GOTO top
END

lab 6.
CLS
INPUT “Enter test score 1”; score1
INPUT “Enter test score 2”; Score 2
INPUT “Enter test score 3”; Score 3
Average = (score1+score2+score3)/3
PRINT “The score is=”; average
IF (average>40) THEN PRINT “congratulation”
END

No comments:

Post a Comment