ICT Role in 21st Century Education & its Challenges.pptx
Programming notations
1. Essential Concepts and Terminologies:
1. Variable – The primary storage location that can assume different numeric or
alphanumeric values.
2. Computer Program – A set of logical instructions given to a computer for data processing that is
interpreted by a compiler to produce useful information.
3. Hungarian Notation – A variable naming convention suggested by Microsoft.
Introduction
A computer is a fast-electronic programmable device operating under the controls of
instructions(program). The device can accept data (input), manipulate data(process), produce results
from the manipulation(output), and store the results for future use(storage).
The term computer is derived from the word “compute” that suggests
computation or calculation. Computers are incredibly good at math. Peopleware (people
who uses computer) used to spend hours calculating results from their formulas and data.
Now, a computer can "compute" results for them in a fraction of a second.
A computer can work efficiently if given a proper instruction through a program. It is therefore a must for
computer programmers to learn the language the computer can understand. This COMPUTER LANGUAGE is
composed of arithmetic operators, logical operators, relational operators, important terminologies
and symbols which programmers can use to create mathematical expressions.
PROGRAMMING
NOTATIONS
2. Arithmetic Operators
Relational Operators
Logical Operators
An OPERATOR in a programming language is a symbol that tells the
computer (compiler or interpreter) to perform specific mathematical,
relational or logical operation and produce final result.
Here they are. Study each of
these operators in order to
understand how they work
within the EXPRESSIONS.
An operator performs an action on one or more operands (variables or numbers).
Arithmetic
Operators
Relational
Operators
Logical
Operators
3. Mathematical Expressions Programming Expressiion Final Value
3𝑎𝑏 3*a*b 30
𝑎2
+ 𝑏2
a*a + b*b
or
a^2 + b^2
29
8𝑎
𝑏3
(8*a)/(b*b*b)
or
(8*a)/(b^3)
5
𝑎2
+ 𝑏2
𝑎𝑏
((a*a)+(b*b))/(a*b)
or
(a^2)+(b^2)/(a*b)
2.9
Operators in arithmetic expressions follow the rules from mathematics. It is important to note that the
arithmetic hierarchy of computation still applies in computers. Computer will first
evaluate expressions inside the parenthesis, power or
exponentiation is evaluated before multiplication and division, while the
former two ( x ÷ ⤳ * / ) are evaluated before addition and subtraction.
PEMDAS rule applies in evaluating an expression (Parenthesis,
Exponentiation, Multiplication, Division, Addition and Subtraction).
In order for computers to understand our
EXPRESSIONS, we must first know how to convert from
mathematical expressions to programming expression
using the operators.
Let’s try to practice. Assuming we have (variable) a with a value of 5, and b with a
value of 2, we will use the letters aand bin the expression.
Remember, letters aand brepresents the numbers 5 and 2 respectively.
The caret sign ^
denotes
exponentiation in
programming
expression.
4. Example: Convert the arithmetic expression ab(a2+b2) to computer expression, we first change the operators. Take note
that if two letters (variables) are side-by-side with the others, the operation is to multiply.
Then, ab ⤳ a*b | b( ⤳ b*( | a2 ⤳ a^2.
Therefore, arithmetic expression: ab(a2+b2)
in computer expression is: a*b*(a^2+b^2)
let’s substitute the values having a=2and b=3: *ba
Notice how we insert the
operators between the
letters (variables) and
numbers.
Arithmetic
Expressions
ab(a2+b2)
Substituted
values
2*b*(a^2+b^2)
Computer
Expressions
2*b*(a*a+b*b)
or
2*3*(2^2+3^2)
2*3*(2*2+3*3)
or
The final value is 78
Note that in some programming languages, the operators
vary in their use. For example, others would use <> for NOT
EQUAL TO, or the Caret ^ maybe of another function rather
than exponentiation.
What we have here are the basic operators. Additional
operators will be defined by other programming language.