DLE QBASIC
PROGRAMMING
Set 1
1. Write a
program to calculate the sum of two numbers.
REM to
calculate the sum of two numbers
CLS
INPUT “Enter the first number”; A
INPUT “Enter the second number”; B
SUM = A + B
PRINT “The sum is=”; SUM
END
2. Write a
program to calculate simple interest and amount
REM to
calculate simple interest and amount
INPUT “Enter the principal amount”; P
INPUT “Enter the rate”; R
INPUT “Enter the time”; T
INTEREST = (P*T*R)/100
AMOUNT = P + INTEREST
PRINT “The Simple Interest is = “;
INTEREST
PRINT “The Amount is = “; AMOUNT
END
3. Write a
program to calculate area of rectangle.
REM to
calculate area of rectangle
INPUT “Enter length of rectangle”;L
INPUT “Enter breadth of rectangle”; B
AREA = L * B
PRINT “The Area of rectangle is=”;AREA
END
4. Write a
program to calculate perimeter of rectangle.
REM to
calculate perimeter of rectangle
INPUT “Enter length of rectangle”; L
INPUT “Enter breadth of rectangle”; B
PERIMETER = 2*(L+B)
PRINT “The perimeter of rectangle is = “; PERIMETER
END
5. Write a program to calculate area of a circle.
REM to
calculate area of a circle
INPUT “Enter radius of a circle”; R
CONST PI = 22/7
AREA = PI * R ^ 2
PRINT “The area of circle is = “; AREA
END
6. Write a
program to calculate perimeter of a circle.
REM to
calculate perimeter of a circle
INPUT “Enter radius of a circle”; R
CONST PI = 22/7
PERIMETER
= 2 * PI * R
PRINT “The perimeter of circle is = “;
PERIMETER
END
7. Write a
program to calculate and display area of four walls. [Hint: Area = 2H(L+B)]
REM to
calculate area of four walls
INPUT “Enter length of room”; L
INPUT “Enter breadth of room”; B
INPUT “Enter height of room”; H
AREA = 2 * H * (L +B)
PRINT “Area of four walls of a room is =
“; AREA
END
8. Write a
program to calculate and display volume of a room.
REM to
calculate volume of a room
INPUT “Enter length of room”; L
INPUT “Enter breadth of room”; B
INPUT “Enter height of room”; H
VOLUME = L * B * H
PRINT “Volume of a room is = “; VOLUME
END
9. Write a
program to accept temperature in Celsius and convert into Fahrenheit. [Hint:
F=9C/5+32]
REM to
convert Celsius into Fahrenheit
INPUT “Enter temperature in Celsius”; C
F = 9 * C / 5 + 32
PRINT “Temperature in Fahrenheit = “; F
END
10. Write a
program to accept a temperature in Fahrenheit and convert it into Celsius. [Hint:
C = (F-32)5/9 ]
REM to
convert Fahrenheit into Celsius
INPUT “Enter temperature in Fahrenheit”; F
C = (F - 32) * 5 / 9
PRINT “Temperature in Celsius = “; C
END
**************
No comments:
Post a Comment