Lesson Notes By Weeks and Term - Senior Secondary School 2

BASIC PROGRAMMING I

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.

  1. REM STATEMENT

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

  1. LET STATEMENT

The LET statement is used to assign (or give) values to variables.

Examples:

10 LET A = B + C

  1. INPUT STATEMENT

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

  1. PRINT STATEMENT

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

  1. END STATEMENT

End Statement is an instruction used to terminate the program. One the computer encounters END statement, it automatically terminates the program.

50 END

  1. RUN STATEMENT

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

  •       Subtraction

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

  1. ……………….. statement is used to assign (or give) values to variables (a) REM        (b) INPUT        (c) LET
  2. ………………… statement is used to execute a program (a) INPUT        (b) RUN        (c) END
  3. …………………  Statement is an instruction used to terminate the program. (a) INPUT        (b) RUN        (c) END
  4. ……………… principle of evaluating arithmetic expression in BASIC programming Language. (a) BODMAS        (b) BODMES        (c) BEDMAS
  5. …………….. statement  is used to assign or give values to variables while program is running (a) INPUT        (b) RUN        (c) END



THEORY

 

  1. Write the function of the following BASIC keywords (a) LET    (b) INPUT    (c) PRINT    (d) REM    (e) RUN
  2. Rewrite the following algebraic expressions as BASIC arithmetic expression. (a) Y= hk2      (b)     (c)     (d)








© Lesson Notes All Rights Reserved 2023