SUBJECT: I.C.T
CLASS: SS 2
DATE:
TERM: 3rd TERM
WEEK 2
TOPIC: BASIC PROGRAMMING I
KEYWORDS IN BASIC PROGRAMMING LANGUAGE
This is also referred to as BASIC statement or a reserved word. It is an instruction in BASIC, which has a specific means to the compiler or interpreter.
The REM statement is a remark statement. It is used to insert remarks in the program. Such remarks are used to explain what the program is all about.
Example:
10 REM This program finds the average of 5 numbers
The LET statement is used to assign (or give) values to variables.
Examples:
10 LET A = B + C
Input is used to assign or give values to variables while program is running. It can be used with both numeric and string variables.
Examples:
10 INPUT A, B, C
The print statement tells your computer to display the output of the executed program on the screen of the monitor (VDU).
Example:
10 PRINT SUMS
End Statement is an instruction used to terminate the program. One the computer encounters END statement, it automatically terminates the program.
50 END
The RUN statement is used to execute a program. In Q-BASIC, F5 is used to RUN a program. Note that the program will not RUN if any mistake or error is detected in it.
BASIC ARITHMETIC OPERATORS
The following are arithmetic operators in BASIC organized in their order of execution:
() Bracket
Ë Exponential
/ Division
* Multiplication
+ Addition
Basic must follow the above order during the execution of the program. In Mathematics, we are familiar with the principle of evaluating algebraic expression using BODMAS but in BASIC programming Language, it is called BEDMAS
BASIC ARITHMETIC EXPRESSION
Algebraic expressions are similar in a way to BASIC arithmetic expressions except for differences in some of their operators.
The following are algebraic expressions and their corresponding BASIC arithmetic expression.
Algebraic Expression | BASIC Arithmetic Expression |
a+b | A+B |
a-b | A-B |
a÷b | A/B |
b5 | BË5 |
a=b*h | A=B*H |
X=am-by+c/z | X=A*M-B*Y+C/Z |
A=(-b+d) 2c | A=(-B+D)/(2*C) |
X | X= -B+ (SQR(BË2-4*A*C))/(2*A) X= -B -(SQR(BË2-4*A*C))/(2*A) |
(x-y) (x+y) | (X-Y)/(X+Y) |
READING ASSIGNMENT: HiiT @ School, Computer Studies for Senior Secondary Education. Chapter Five, pages 34-36, 110.
WEEKEND ASSIGNMENT
OBJECTIVES
THEORY
© Lesson Notes All Rights Reserved 2023