SSS 3 WEEK 3: BASIC PROGRAMMING



The meaning of BASIC
In computer programming BASIC is an acronym for Beginners All-purpose Symbolic Instruction Code, it’s a high level programming language.

- BASIC Character set
BASIC has character set consisting of the following characters:
Alphabets A – Z
Digits 0 – 9
Special characters +,-,*,/,@,(),.,$,;,#,:,<,>,”,= etc.

- BASIC STATEMENT
In BASIC programs are written in lines, each lines starts with a line number which is a label of that particular line. Each one of the line is called statement. And line numbers can vary from 1 to 9999 depending on how lengthy the program could be.
Below are also BASIC action words that are known as BASIC keywords that are used to perform series of actions and are used to form a BASIC statement. Some examples are as listed below:

- CLS
- REM
- LET
- READ
- INPUT
- DATA
- PRINT
- END

Basic Arithmetic operators
- The following are arithmetic operators in BASIC organized in their order of execution.
( ) Bracket
^ Exponentiation
/ Division
* Multiplication
+ Addition
- Subtraction

BASIC BUILT-IN FUNCTIONS AND SAMPLE PROGRAMS
These are mathematical functions that are built in BASIC. Some common BASIC Functions are listed below:

- SQT ()
- ABS ()
- LOG ()
- SIN ()
- COS ()
- TAN ()
- INT ()
- RND ()
- EXP ()

Simple BASIC program to illustrate Built-in functions

SQR or SQRT – finds the square root of a positive number.
10 PRINT SQR (255)

ABS – this displays the absolute value of a given number
10 PRINT ABS (X)

LOG – this finds the logarithm value of a given number
10 CLS
20 LOG (26.7)

SIN – finds the sine value of an Angle
10 CLS
20 CONST PI=3.142
30 PRINT (SIN (90*(PI/180)))
40 END

COS – finds the cosine of an angle
10 CLS
20 CONST PI=3.142
30 PRINT (COS (180*(PI/180)))
40 END

TAN – finds the tangent of an angle
10 PRINT TAN (23)

EXP – finds the exponentiation of  a number
10 CLS
20 PRINT EXP (8)
30 END

INT – finds the integer of a real number
10 CLS
20 PRINT INT (2998.9)
30 END

Comments

Popular posts from this blog

JSS 3 WEEK 4: INTERNET (SEARCH ENGINES)

JSS 3 - CHARTS AND GRAPHS

JSS 3 WEEK 7 - 8: HUMAN ISSUE