The website has the complete lesson note for all the subjects in secondary school but this piece showcases the JSS2 Computer Studies Lesson Note on Simple BASIC Statements. You can use the website search button to filter out the subject of interest to you.

CLICK HERE to download the complete Document: DOWNLOAD HERE

Sub-Topic 4:              Simple BASIC Statements

Structure of BASIC program

  • One instruction or statement per line
  • Each line must begin with a line number
  • Line numbers are unsigned positive integers
  • Line number should increase in steps of 10 to allow for insertion of extra lines during program modification.

Example 1:  Write a BASIC program to find the average of three numbers.

Solution:

5          REM FIND AVERAGE

10        READ A, B, C

20        DATA 5, 10, 15

25        LET SUM=A+B+C

30        LET AVE=SUM/3

35        PRINT AVE

40        END

Example 2: Write a BASIC program to calculate the volume of a box.

Solution:

10        REM FIND THE VOLUME OF A BOX

20        READ L, B, H

30        DATA 3,5,10

40        LET VOLUME =L*B*H

50        PRINT VOLUME

60        END

Conditional Statements

These are statements in BASIC programming that are dependent on some certain conditions and criteria before they can be obeyed. Example is IF…THEN…ELSE

IF…THEN…

This is a conditional statement. If the condition is true, the statement following the “THEN” is executed.

Example

2 INPUT A

IF A > 500 THEN GOTO 50 ELSE GOTO 2

50 PRINT A

60 END

Sample program

10 REM PROGRAM TO PRINT NAME AND ADDRESS

20 LET A$=”Deeper Life High School”

30 LET B$=”Opete off DSC Express Way, Warri, Delta State”

40 PRINT A$

50 PRINT B$

60 END

Click on the Downloadable Button to get the FULL NOTE

Copyright warnings! Do not copy.