Wednesday 27 February 2019

2019 SS1 WEEK 8 LESSON TOPIC: BASIC ARITHMETIC OPERATION

Content: BASIC ARITHMETIC OPERATORS: They are expressed in terms of a hierarchy of operations in which operations of high priority are performed first. BASIC operator includes the following. OPERATOR SYMBOL OPERATION ^ Exponential * Multiplication / Division + Addition _ Subtraction BASIC ARITHMETIC EXPRESSION These Arithmetic expressions are not formed according to the same rule of Algebra and mathematics. The following symbols are used to denote arithmetic operations. SYMBOL MEANING EXAMPLE IN ARITHMETIC IN BASIC ↑ Exponential BA B↑A * Multiplication A x B A * B / Division A/B A/B + Addition A + B A + B _ Subtraction A - B A - B The following rule most be adhered to Precedence Rules: The BASIC expression equally follows the precedent rule. The computer will perform the exponential first, then multiplication or division, then addition or subtraction And if two or more operators of the same hierarchy appear in an expression, the order of evaluation is from left to right Example Mathematic Expression BASIC Expression a b d (A * B * D) (c + d)(e +f) ( C + D)*(E + F) 6 X3 6 * X^3 (2 X y)/(c-B ) 2 *Y / c – B LOGICAL OPERATORS They operate tests on multiple relations or BOO lean operators Examples: = Equal to < Less than > Greater than <= Less than or equal to <> Not equal to PUNCTUATION MARKS Examples: (.) Decimal (,) Comma (“”) Quotation Mark (:) Colon & Semi colon (;) BASIC STATEMENT: They are statement that causes the computer to execute certain actions. ORDER OF OPERATIONS Line number Remark (REM) Assignment ( LET, INPUT, DATA) Output statement Print Programme terminator [END, STOP] Write a BASIC program to find the area of a rectangle 10 REM PROGRAM TO FIND THE AREA OF A RECTANGLE 20 REM AND PRINT AREA 30 INPUT “ENTER THE LENGTH OF THE RECTANGLE”; L 40 INPUT “ENTER THE BREADTH OF THE RECTANGLE”; B 50 AREA = L* B 60 PRINT “AREA =”, AREA 70 END

No comments:

Post a Comment