QBasic General Programs


 QBasic General Programs 

(Sunrise Publication Class 6 Computer Science)

a. To display your name and your school's name side by side and zone wise.

CLS
PRINT "Mohan Kumar   Abc School"
PRINT "John Doe   XYZ High School"
END

b. A program that asks you to input any three numbers and store them in three different variables. Calculate and display their sum and product.

CLS
INPUT "Enter first number: ", num1
INPUT "Enter second number: ", num2
INPUT "Enter third number: ", num3
sum = num1 + num2 + num3
product = num1 * num2 * num3
PRINT "Sum:"; sum
PRINT "Product:"; product
END

c. To calculate and display the total price of 20 pencils if a pencil costs Rs 3.

CLS
cost = 3
pencils = 20
totalPrice = cost * pencils
PRINT "Total Price of 20 Pencils:"; totalPrice
End

d. A program that asks you to input your name and marks in three subjects: computer, science and math. Calculate and display their average marks.

CLS
INPUT "Enter your name: ", name$
INPUT "Enter marks in Computer: ", computer
INPUT "Enter marks in Science: ", science
INPUT "Enter marks in Math: ", math
average = (computer + science + math) / 3
PRINT "Average Marks for "; name$;" :"; average
End

e. A program that asks length and breadth of a room. Calculate and display its area.

CLS
INPUT "Enter length of the room: ", length
INPUT "Enter breadth of the room: ", breadth
area = length * breadth
PRINT "Area of the Room:", area
END

f. A program that asks radius of a circle; then calculate and display its area.

CLS
INPUT "Enter radius of the circle: ", radius
area = 3.14 * radius * radius
PRINT "Area of the Circle:", area
END

g. A program that asks principal amount, rate and time; then calculate and display the simple interest.

CLS
INPUT "Enter principal amount: ", principal
INPUT "Enter rate of interest: ", rate
INPUT "Enter time (in years): ", time
SI = (principal * rate * time) / 100
PRINT "Simple Interest:"; SI
END

h. A program that asks you to input two numbers and find out which is greater or less.

CLS
INPUT "Enter first number: "; num1
INPUT "Enter second number: "; num2
IF num1 > num2 THEN
PRINT num1; "is greater."
ELSE
PRINT num2; "is greater."
END IF
END

i. A program that asks you to input length in centimeter and calculate its length in meter.

CLS
INPUT "Enter length in centimeters: "; cm
meter = cm / 100
PRINT "Length in Meters:"; meter
END

j. A program that asks you to input weight in gram and calculate its weight in kilogram.

CLS
INPUT "Enter weight in grams: ", grams
LET kg = grams / 1000
PRINT "Weight in Kilograms:", kg
END

k. A program that asks you to input temperature in Celsius and calculate its temperature in Fahrenheit.

CLS
INPUT "Enter temperature in Celsius: "; celsius
fahrenheit = (celsius * 9 / 5) + 32
PRINT "Temperature in Fahrenheit:"; fahrenheit
END

1. A program that asks you to input money in Nepali currency and convert its value in dollar. [Rs. 1 = 90$]

CLS
INPUT "Enter money in Nepali Rupees: "; NC
dollar = NC * 90
PRINT "Money in Dollar:"; dollar
END

m. Hari Bahadur has deposited Rs. 50,000/- in bank for 3 years. Write a program to calculate simple interest of his amount if the interest rate is 12%.

CLS
LET principal = 50000
LET rate = 12
LET time = 3
LET SI = (principal * rate * time) / 100
PRINT "Simple Interest :"; SI
END

n. A program that asks you to input name of item, price of item and number of item you want to buy; then calculate the price you have to pay for them.

CLS
INPUT "Enter name of item: " ; name
INPUT "Enter price of item: " ; price
INPUT "Enter number of items to buy: "; num
total = price * num
PRINT "Total Price is"; total
END

o. A program that asks you to input length, breadth and height of a box and calculate its volume.

CLS
INPUT "Enter length of the box: "; length
INPUT "Enter breadth of the box: "; breadth
INPUT "Enter height of the box: "; height
volume = length * breadth * height
PRINT "Volume of the Box:"; volume
END

p. A program that asks you to input a number then calculates the square and square root of that number.

CLS
INPUT "Enter a number: ", num
square = num * num
squareRoot = num ^ (1/2)
PRINT "Square : "; square
PRINT "Square Root: "; squareRoot
END
Founder of Notehubs Nepal, Software Developer, Content Creator, Graphic Designer

Post a Comment

© Notehubs Nepal. All rights reserved. Distributed by ASThemesWorld