BASIC PROGRAMS
1. Write a program to accept the length and breadth of a
rectangular field and calculate and display its area and
perimeter.
Area = L × B
Perimeter = 2*(L + B)
CLS
Rem program to calculate the area and perimeter of rectangle
INPUT “Enter the length” ,L
INPUT “Enter the breadth” , B
A=L*B
P = 2*(L + B)
PRINT “Area is”+ A
PRINT “Perimeter is”+P
2. A man goes to a shop and buys 7 packets of pencils, 23
notebooks, 55 erasers, and 62 sharpeners. Write a
program in BASIC to find and display the total bill if one
packet pencil costs Rs. 80, one notebook costs Rs. 35,
one eraser costs Rs. 5 and one sharpener costs Rs. 4.
CLS
Rem program to calculate total bill
PP = 7 * 80
NP = 23 * 35
EP = 5 * 55
SP = 62 * 4
TP = PP + NP + EP + SP
PRINT “Total price is Rs.”+ “ ”+TP
3. Write a program to accept the radius of a circular field and
calculate its area and circumference.
Pi= 22/7
Area = Pi × R2
Circumference = 2 × Pi × R
CLS
Rem program to calculate the area and circumference of circle
INPUT “Enter the radius”, R
Pi=3.14
A = Pi * R*R
C = 2 * Pi * R
PRINT “Area is”+ A
PRINT “Circumference is”+ C
4. Write a program to input the distance travelled in km by a
train and time taken by it in hr.
Calculate and display the average speed of that train.
Average Speed = Distance / Time
CLS
Rem program to calculate Speed
INPUT “Distance travelled” ,D
INPUT “Time taken” ,T
S=D/T
PRINT “Average Speed:” +S
GIVE THE OUTPUT OF THE FOLLOWING PROGRAMS-
1. CLS
REM program to print in the given format
Print “2” + “3”
Print 12 + 40
Print “Thank”+ “ ”+ “You”
OUTPUT:
23
52
Thank You
2.
CLS
REM program to print in the given format
x=100
y=2
Print x, y
C=x/y
Print C
Print “I got it”
OUTPUT:
100 2
50
I got it