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.
CLSInput " Enter the name ";N$Input " Enter the city";C$Input " Enter the country";CO$Input " Enter the age";APrint " The name is ";N$Print " The city is ";C$Print " The country is ";CO$Print " The age is ";AEnd
Sum of two numbers
CLSREM To find Sum of two numbersINPUT "Enter the first number"; aINPUT "Enter the second number"; bSUM = a + bCOLOR 5PRINT TAB(5); "The sum of two number is"; SUM;END
Write a program to find the area of the triangle.
ClsInput " enter the base" ;bInput " enter the height" ;hlet T = 1/2*b*hPrint" The area of triangle=" ;TEnd
Write a program to find Area of Rectangle
ClsInput " enter the length " ;lInput " enter the breadth " ;blet A = l*bPrint" the area of rectangle=" ;aEnd
Write a program to find the volume of cuboid
CLSREM To find volume of cuboidINPUT "Enter the length" ; lINPUT "Enter the breadth": bINPUT "Enter the height" ; hVOLUME = l * b * hPRINT "The volume of cuboid is"; VOLUMEEND
Write a program to find the volume of cube
CLSREM To find volume of cubeINPUT "Enter the length" ; lVOL = l ^3PRINT "The volume of cube is" ; VOLEND
Write a program to find the area of circle
ClsInput" Enter the radius " ;RLet C=22/7*R^2Print " The area of circle =" ;CEnd
Write a program to find the area of circle if radius is 9 cm
CLSREM To find the area of circle if radius is 9 cmLET r = 9LET PI = 3.14AREA = PI * r ^ 2PRINT "The area of circle is" ; AREAEND
Write a program to convert the weight from kilogram to pounds.
CLSInput"Enter the weight in kilogram";KLet P=K*2.2Print "The pound is ";PEnd
Write a program to input the student’s name, marks of any three subjects. Find total and percentage
CLSREM “To find result”INPUT "Enter the name of student" ; n$INPUT "Enter the marks of English"; engINPUT "Enter the marks of Nepali" ; nepINPUT "Enter the marks of Computer"; comTOTAL = eng + nep + comPER = eng + nep + com / 300 * 100PRINT "Student’s name" ; n$PRINT "Total marks of student" ; TOTALPRINT " Percentage of student"; PEREND
Write a program to convert the distance from miles to kilomiles.
ClsInput " Enter the length in miles";MLet K=M*1.6Print" The length in kilo miles=";KEnd
Write a program to find out the Simple Interest.
ClsInput " Enter the Principal";PInput " Enter the Rate";RInput " Enter the Time";TLet I = P*T*R/100Print " The simple Interest = ";IEnd