Qbasic programming examples and exercises

Qbasic programming examples and exercises for BLE, SEE, NEB.

Qbasic Programming Class 10Computer Programming in QBASIC

Qbasic programming language is a branch of Basic Programming, which is a third-generation language. it is mostly used by children or beginners in Programming.

Starting QBASIC(from DOS)

  • Turn on the computer.
  •  Click on the start button and get DOS prompt. 
  • Change the directory to QBASIC.
  •  C:\> CD QBASIC [Press Enter Key]
  •  C:\> QBASIC > QB [Press Enter Key] 
  • Now you will see the screen:


Qbasic programming examples and exercises 

Some Important Question solution about Qbasic programming.

Write a program to enter your name, city, country, age and print them.

CLS
Input " Enter the name ";N$
Input " Enter the city";C$
Input " Enter the country";CO$
Input " Enter the age";A
Print " The name is ";N$
Print " The city is ";C$
Print " The country is ";CO$
Print " The age is ";A
End

Sum of two numbers

CLS
REM To find Sum of two numbers
INPUT "Enter the first number"; a
INPUT "Enter the second number"; b
SUM = a + b
COLOR 5
PRINT TAB(5); "The sum of two number is"; SUM;
END

Write a program to find the area of the triangle.

Cls
Input " enter the base" ;b
Input " enter the height" ;h
let T = 1/2*b*h
Print" The area of triangle=" ;T
End

Write a program to find Area of Rectangle

Cls
Input " enter the length " ;l
Input " enter the breadth " ;b
let A = l*b
Print" the area of rectangle=" ;a
End

Write a program to find the volume of cuboid

CLS
REM To find volume of cuboid
INPUT "Enter the length" ; l
INPUT "Enter the breadth": b
INPUT "Enter the height" ; h

VOLUME = l * b * h
PRINT "The volume of cuboid is"; VOLUME
END

Write a program to find the volume of cube

CLS
REM To find volume of cube
INPUT "Enter the length" ; l
VOL = l ^3

PRINT "The volume of cube is" ; VOL 
END

Write a program to  find the area of circle

Cls
Input" Enter the radius " ;R
Let C=22/7*R^2
Print " The area of circle =" ;C
End

Write a program to find the area of circle if radius is 9 cm

CLS
REM To find the area of circle if radius is 9 cm
LET r = 9
LET PI = 3.14
AREA = PI * r ^ 2
PRINT "The area of circle is" ; AREA
END

Write a program to convert the weight from kilogram to pounds.

CLS
Input"Enter the weight in kilogram";K
Let P=K*2.2
Print "The pound is ";P
End

Write a program to input the student’s name, marks of any three subjects. Find total and percentage

CLS
REM “To find result”
INPUT "Enter the name of student" ; n$
INPUT "Enter the marks of English"; eng
INPUT "Enter the marks of Nepali" ; nep
INPUT "Enter the marks of Computer"; com
TOTAL = eng + nep + com
PER = eng + nep + com / 300 * 100
PRINT "Student’s name" ; n$
PRINT "Total marks of student" ; TOTAL
PRINT " Percentage of student"; PER
END

Write a program to convert the distance from miles to kilomiles.

Cls
Input " Enter the length in miles";M
Let K=M*1.6
Print" The length in kilo miles=";K
End

Write a program to find out the Simple Interest.

Cls
Input " Enter the Principal";P
Input " Enter the Rate";R
Input " Enter the Time";T
Let I = P*T*R/100
Print " The simple Interest = ";I
End

Founder of Notehubs Nepal, Software Developer, Content Creator, Graphic Designer

Post a Comment

© Notehubs Nepal. All rights reserved. Distributed by ASThemesWorld