Sei sulla pagina 1di 26

BASIC ELEMENTS

OF PROGRAMMING

REPORTER: GROUP 3
11-HUMSS 4
WHAT IS
PROGRAMMING?
PROGRAMMING
• The action or process of writing computer programs.
• The process of developing and implementing various
sets of instructions to enable a computer to do a
certain task. These instructions are considered
computer programs and help the computer to operate
smoothly. The language used to program computers is
not understood by an untrained eye. Computer
programming continues to be a necessary process as
the Internet continues to expand.
5 BASIC ELEMENTS OF
PROGRAMMING

• input: getting data and commands into the computer


• output: getting your results out of the computer
• arithmetic: performing mathematical calculations on
your data
• conditional: testing to see if a condition is true or false
• looping: cycling through a set of instructions until some
condition is met
INPUT
Input can take a variety of forms, from commands you
enter from the keyboard to data from another computer
or device. A device that feeds data into a computer, such
as a keyboard or mouse, is called an input device. (v.)The
act of entering data into a computer.
OUTPUT

Data generated by a computer is referred to


as output. This includes data produced at a software
level, such as the result of a calculation, or at a
physical level, such as a printed document. A basic
example of software output is a calculator program
that produces the result of a mathematical
operation.
ARITHMETIC
Arithmetic operations. Boolean operations
→ Arithmetic Operation - is a function which can perform
one of the following tasks: adding, subtracting,
multiplying and dividing. Operator -
a programming device that performs a function on one or
more inputs, for example arithmetic operators (+,-,/,*)
CONDITIONAL

In computer science, conditional statements, conditional


expressions and conditional constructs are features of a
programming language, which perform different
computations or actions depending on whether
a programmer-specified boolean condition evaluates to true
or false.
LOOPING
In computer programming, a loop is a sequence of instruction s
that is continually repeated until a certain condition is reached.
Typically, a certain process is done, such as getting an item of data
and changing it, and then some condition is checked such as
whether a counter has reached a prescribed number.
DATA
In computer science and computer programming, a data type or
simply type is an attribute of data which tells
the compiler or interpreter how the programmer intends to use the data.
Most programming languages support common data types
of real, integer and boolean. A data type constrains the values that
an expression, such as a variable or a function, might take. This data type
defines the operations that can be done on the data, the meaning of the
data, and the way values of that type can be stored. A type of value from
which an expression may take its value.
TYPES OF DATA
• Int- Integer: a whole number
• Float- Floating point value: ie a number
with a fractional part.
• Double- a double-precision floating
point value.
• Char- a single character.
• Void- valueless special purpose type
which we will examine closely in later
sections.
TWO TYPES OF STATEMENT

• PRIMITIVE VARIABLE
-WHEN ON THE LEFT OF
- Contains actual data
• REFERENCE VARIABLE
- Preview data is replaced with new data
-Old reference is replaced with a new
reference
FLOWCHART
- Is a graphical presentation of the
procedure involved in the solution or
problems. This consists of symbols that
are interconnected to provide illustration
of the flow of control in a program. In can
be use to show variety of different
procedure at different level.
TWO TYPES OF
FLOWCHART
• System Flowchart
- Shows the overall activities in a system.
• Program Flowchart
- Depicts the logic or the orders of instruction
to solve a specific problem.
BASIC
FLOWCHARTING
SYMBOL
TERMINAL BLOCK
-THIS IS USE TO INDICATE THE BEGINNING OR END OF THE PROGRAM.

INPUT/OUTPUT BLOCK
- USE FOR INPUT OR DISPLAYING DATA
PROCESSING BLOCK
-USE FOR MATHEMATICAL OPERATION (FORMULA).

DECISION BLOCK
- USE FOR LOGICAL/RELATIONAL OPERATION ANSWERABLE BY YES/NO.
PREPARATION/INITIALIZATION BLOCK
-USE FOR DECLARING VARIABLES.

FLOW LINES
- USE TO THE DIRECTION OF DATA.
ON PAGE CONNECTOR
-USE TO CONNECT THE FLOW CHART ON THE SAME PAGE.

OFF PAGE CONNECTOR


-USE TO CONNECT FLOW CHART IN ANOTHER PAGE.
SEQUENCE CONTROL STRUCTURE

Start A

Input num 2
Display “Enter the
First Value”
Ans = num 1 +
num 2
Input num 1

Display Ans

Display “Enter the


Second Value”
End

A
SELECTION CONTROL STRUCTURE

Start

Display
“Enter Age”

Input Age

Y Is
Display
Age<=17
“Qualified”
?

End Display “Not


Qualified”

Potrebbero piacerti anche