BASIC PROGRAMMING

BASIC has a number of built in functions that greatly extend its capability. These functions perform such varied task as taking the square root of a number, counting the number of characters in a string, and capitalizing letters. Functions associate with one or more values, called input, a single value called output.

 

NUMERIC FUNCTIONS: SQR, INT

SQR calculates the square root of a number. The function INT finds the greatest integer less than or equal to a number. Therefore INT discards the decimal parts of a number.

Example:

SQR(9) is 3

INT(2.7) is 2

The terms in the parentheses can be numbers (as above), variables, or expressions.

 

ABS FUNCTION

Its full form is absolute. It is used to find the absolute value of a number. Absolute value of a number means the number without a sign.

Examples:

ABS(+3.4) = 3.4

ABS(- 3.4) = 3.4

 

RND FUNCTION

RND is a special function that gives us a random number between 0 and 1. This can be used in dice games to make it more interesting.

COS, SIN, TAN, ATN FUNCTIONS

COS (Cosine)

SIN(Sine)

TAN(Tangent)

ATN(Arctangent, inverse of TAN)

 

Example:

CONST pi =3.14

PRINT COS(pi/4)

PRINT SIN(pi/4)…….etc.

 

MOD FUNCTION

It means remainder. This function returns the remainder after division

 

Example:

16 MOD 5 = 1

30 MOD 5 = 0

 

EXP FUNCTION

The EXP function is used to calculate the exponential function i.e raise e to some power, where value of e is 2.13. The general form of exponential is EXP(X). e.g :

EXP(4) = 54.59815

EXP(-5) = 6.73794 E-03

 

LOG FUNCTION

LOG(X) gives the natural logarithm of X

MATHEMATICAL EXPRESSION                                                    BASIC NOTATION

 

(X -Y)/(X+Y) (X -Y)/(X+Y)
EXP (X^2 + Y) – SIN(X + N*y)
b =1/ 4ac B =1/ 4*A* C

 

1.                 List five BASIC functions and what they do

 

Student are allowed to give corrections to the assessment given by the teacher ,while the teacher support s them in order to guide them

 

See also

FLOW CHART

ALGORITHM AND FLOW CHART

PROGRAM DEVELOPMENT

Program Development

SYSTEM DEVELOPMENT CYCLE

Acadlly Playstore Brand logo 350 x 350