What is QBasic
QBasic is a beginner-friendly programming language developed by Microsoft. It’s great for
learning the basics of programming because it has a simple syntax and immediate feedback.
Type: Procedural programming language
Platform: DOS
Purpose: Teaching programming concepts
Why Learn QBasic?
Simple syntax for beginners
Easy to test and run programs
Good for learning programming logic and algorithms
Teaches structured programming
What is an Algorithm?
An algorithm is a step-by-step procedure to solve a problem.
Think of it as a recipe for your program.
Every program is basically an algorithm implemented in code.
Example: To add two numbers:
Algorithm in steps:
1. Start
2. Get first number from user
3. Get second number from user
4. Add the two numbers
5. Display the result
6. End
4. Implementing Algorithms in QBasic
a) Simple Addition Program
Algorithm:
1. Start
2. Input num1
3. Input num2
4. sum = num1 + num2
5. Print sum
6. End
QBasic Code:
CLS
REM Program to add two numbers
INPUT "Enter first number: ", num1
INPUT "Enter second number: ", num2
sum = num1 + num2
PRINT "The sum is "; sum