Example: Simple BASIC Addition Program - JSS2 Computer Studies Lesson Note
REM Simple BASIC Addition Program
A = 10
B = 5
SUM = A + B
PRINT "The sum of A and B is "; SUM
END
This program initializes two variables, A and B, calculates their sum, and prints the result on the screen.
- The REM statement provides a comment for program identification.
- A and B are declared and assigned initial values.
- The SUM variable stores the result of the addition.
- The PRINT statement displays the output to the user.
- The END statement signifies the end of the program.
Conclusion:
Writing a simple BASIC program involves a few key steps, including initialization, variable declaration, executable statements, user input (if needed), program output, and program termination. This example demonstrates the basic structure and syntax of a BASIC program, making it a suitable starting point for those new to programming.