Qbasic Programming Examples and Exercises

In this article, we will learn about QBasic examples and exercises for class 6 and class 7 standards.

Qbasic  sample example programs for beginners. In this post, we will see and learn some  QBasic programming examples  and do some simple exercises to understand how it works.

Table of Contents

This post has beginner-level Qbasic examples and exercises that will help you to understand the concept of variable and Qbasic statements like INPUT, PRINT, CLS, etc

Before getting started it is important to know the basic Qbasic statements or QBasic commands first.

Read more about it, check: –  QBasic Commands and Statements-2020

Here, we will code and learn some simple examples that are easy to understand for class 6/ class 7 students, who have started with  QBasic programming.

Here, the program codes are explained with their formulas to help you understand them better.

Examples of some Qbasic Programming Examples and

Write a qbasic program to enter your name and print it..

INPUT ‘Enter your name’;n$

PRINT ‘The name is’;n$

Here since the input data is a string then the variable name ( n ) in which it is to be stored is written after INPUT command followed by $ sign( n$ ).

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

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

Since the entered value of name, city, and country is a string so we write the variable name with a $(dollar sign) before them, and since age is a number so the variable name is written directly.

Write a program to find the area of a rectangle in Qbasic.

FORMULA:  Area of a Rectangle is length x breadth. Here length is variable  l  and breadth is variable  b . And is the variable to store the value of the result and print it as output.

INPUT ” Enter the length ” ;l

INPUT ” Enter the breadth ” ;b

LET A = l*b

PRINT” The area of rectangle=” ;a

Write a program to find the area of the triangle.

FORMULA:   Area of triangle is ½ x base x height.

Here variable  b  is the base and  h  is the height. T is the variable to store the result and print it.

INPUT ” Enter the base” ;b

INPUT ” Enter the height” ;h

LET T = 1/2*b*h

PRINT” The area of triangle=” ;T

Write a Qbasic program to find the area of the circle.

FORMULA  : Area of a circle is 22/7 x radius^2. Here we use variable  R  as Radius. And  C  is the variable where we store the result.

INPUT” Enter the radius ” ;R

LET C=22/7*R^2

PRINT ” The area of circle =” ;C

Write a program to find the area of the square.

FORMULA:  Area of a square is = Side2  square units. Here the result is stored in variable “ square ”.

INPUT” Enter the number” ;n

LET square= n^2

PRINT” The area of square=” ;Square

Write a Qbasic program to find the volume of the box.

FORMULA : Area of a box = length x breadth x height.

The variable are  l ,  b  , and  h  for length, breadth and height and the result will be stored in the variable  volume .

INPUT ” Enter length ” ;l

INPUT ” Enter breadth ” ;b

INPUT ” Enter height ” ;h

LET vol= l*b*h

PRINT” The volume of box is =” ;vol

Write a Qbasic program to find the circumference of the circle.

FORMULA  : Formula of circumference = 22/7 x Radius x 2

LET Circumference=22/7*R*2

PRINT ” The area of circle =” ;Circumference

Write a program to find out the Simple Interest.

FORMULA : Simple Interest = Principle x Rate x Time / 100

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

Example 10:

Write a program to find out the simple Interest and the Amount.

FORMULA  : Formula of Simple Interest = Principle x Rate x Time / 100 Amount = Principle + Simple Interest

LET A= P + I

PRINT ” The amount=”;A

Update: More Qbasic Examples

GET MORE QBASIC EXAMPLES AND EXERCISE IN QBAISC EXAMPLES

So, these are some common  Qbasic programming examples  that are useful for students and new programmers.  These posts will be updated frequently with new  Qbasic examples and exercises , so keep visiting for more fun programming exercises.

Related Posts

Qbasic Color statement

Qbasic Color statement

QBasic Commands and Statements

QBasic Commands and Statements-2023

QBasic 1.1 - Keywords, Functions, Statements

At a glance, qbasic online manual.

This section contains the complete command set (keywords, functions, statements, operaters) of QBasic 1.1 , listed in alphabetical order.

After clicking a keyword, the corresponding information will be displayed: Description, Syntax, Parameters, Examples and related Links.

Worth knowing

Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.

You are here: References Overview > QBasic 1.1 Commands List

IMAGES

  1. QBasic Tutorial 7

    assignment statement in qbasic

  2. Computer Programming: Assignment Statements in QBasic, Java and Python

    assignment statement in qbasic

  3. LESSON 4 HOW TO USE SELECT CASE STATEMENT STATEMENT IN QBASIC

    assignment statement in qbasic

  4. PPT

    assignment statement in qbasic

  5. QBasic Tutorial 8

    assignment statement in qbasic

  6. QBasic Tutorial 4

    assignment statement in qbasic

VIDEO

  1. Pre Course Statement of Understanding Assignment

  2. Mediation Opening Statement Assignment

  3. How To Solve QBASIC Sorting Question 2(Ascending Order)

  4. 2.15 CONSTANTS & ASSIGNMENTS

  5. If statement in Qbasic With example || QB64 || greater than and less than solve

  6. fye major assignment: statement of purpose