0% found this document useful (0 votes)
43 views6 pages

BASIC Programming Training1

Training manual

Uploaded by

Schweib Baour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views6 pages

BASIC Programming Training1

Training manual

Uploaded by

Schweib Baour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

INTRODUCTION TO COMPUTER PROGRAMMING

What is Computer Programming?


Computer programming is the process of writing instructions (called programs)
that a computer can follow to perform specific tasks. These instructions are
written in a Programming Language.

Why Do We Program?
 To control the computer to do what we want.
 To solve problems.
 To create applications (software, games, websites, databases, etc.).

Steps in Programming
1. Problem Definition – Understand the problem.
2. Algorithm Design – Write down steps to solve it.
3. Coding – Translate the steps into a programming language.
4. Testing & Debugging – Check for errors and correct them.
5. Documentation & Maintenance – Explain and update the program.

PROGRAMMING LANGUAGES
Types of Programming Languages
1. Machine Language (Binary: 0s and 1s)
o Example: 10101001
2. Assembly Language
o Uses short codes called mnemonics.
o Example: MOV A, B
3. High-Level Languages
o Close to human language, easier to learn.
o Examples: BASIC, Python, C, Java, Pascal.

Generations of Programming Languages


1. First Generation (1GL) – Machine language.
2. Second Generation (2GL) – Assembly language.
3. Third Generation (3GL) – High-level languages (e.g., BASIC, C, Pascal).
4. Fourth Generation (4GL) – Languages like SQL, MATLAB.
5. Fifth Generation (5GL) – AI and logic-based languages (e.g., Prolog, Lisp).

INTRODUCTION TO BASIC PROGRAMMING LANGUAGE


What is BASIC?
 BASIC = Beginner’s All-purpose Symbolic Instruction Code
 Developed in 1964 to help beginners learn programming.
 Very simple and easy to use.

Features of BASIC
 Easy to learn.
 Uses English-like commands.
 Uses line numbers (10, 20, 30…).
 Allows structured programming.
Structure of a BASIC Program
 Line Numbers (e.g., 10, 20, 30).
 Statements (PRINT, INPUT, LET, IF…THEN, GOTO).
 Comments (notes for the programmer).

BASIC COMMANDS WITH EXAMPLES


1. PRINT Statement
Displays text or results.
10 PRINT "HELLO, WELCOME TO BASIC PROGRAMMING"
20 END
Output:
HELLO, WELCOME TO BASIC PROGRAMMING

2. INPUT Statement
Takes input from the user.
10 INPUT "ENTER YOUR NAME: ", N$
20 PRINT "WELCOME "; N$
30 END
Output (if user enters YAYABIG):
WELCOME YAYABIG
3. LET Statement
Assigns a value to a variable.
10 LET A = 5
20 LET B = 10
30 LET C = A + B
40 PRINT "THE SUM IS "; C
50 END
Output:
THE SUM IS 15

4. IF…THEN Statement
Used for decision making.
10 INPUT "ENTER A NUMBER: ", X
20 IF X > 0 THEN PRINT "POSITIVE"
30 IF X < 0 THEN PRINT "NEGATIVE"
40 IF X = 0 THEN PRINT "ZERO"
50 END
Output (if input = 5):
POSITIVE

5. GOTO Statement
Jumps to another line number.
10 PRINT "BASIC PROGRAM LOOP"
20 GOTO 10
(This runs forever — infinite loop.)

6. FOR…NEXT Loop
Used to repeat a set of instructions.
10 FOR I = 1 TO 5
20 PRINT "NUMBER = "; I
30 NEXT I
40 END
Output:
NUMBER = 1
NUMBER = 2
NUMBER = 3
NUMBER = 4
NUMBER = 5

SIMPLE PROJECTS IN BASIC


Project 1: Calculate Area of a Rectangle
10 INPUT "ENTER LENGTH: ", L
20 INPUT "ENTER WIDTH: ", W
30 LET AREA = L * W
40 PRINT "AREA OF RECTANGLE = "; AREA
50 END

Project 2: Simple Calculator


10 INPUT "ENTER FIRST NUMBER: ", A
20 INPUT "ENTER SECOND NUMBER: ", B
30 PRINT "SUM = "; A+B
40 PRINT "DIFFERENCE = "; A-B
50 PRINT "PRODUCT = "; A*B
60 PRINT "QUOTIENT = "; A/B
70 END

You might also like