Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

PROGRAM LOGIC FORMULATION

COURSE FOUNDATION IN
PROGRAMMING

BY: ZANDRO A. AMANGUITON, M.E.,


MSCS CAR
DESIGNING THE PROGRAM
ADVANTAGES OF USING FLOWCHART
1. Communication
2. Effective analysis
3. Proper documentation
4. Efficient Coding
5. Proper Debugging
6. Efficient Program Maintenance
DESIGNING THE PROGRAM
LIMITATIONS OF USING FLOWCHART
1. Complex logic
2. Alterations and Modifications
3. Reproduction
4. The essentials of what is done can easily be lost in the
technical details of how it is done.
DESIGNING THE PROGRAM
TYPES OF FLOWCHART
1. System Flowchart (Data Flow Diagram) - A data flow
diagram (DFD) is a significant modeling technique for
analyzing and constructing information processes.
SYSTEM FLOWCHART
DESIGNING THE PROGRAM
TYPES OF FLOWCHART
2. Program Flowchart - A flowchart shows how your program
works before you begin actually coding it.
PROGRAM FLOWCHART
ARITHMETIC OPERATORS
Arithmetic Operators includes addition, subtraction,
multiplication and division.
Symbol Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus (Remainder) 11/3 = 2
RELATIONAL OPERATORS
Relational Operators
Symbol Meaning
> Greater than
< Less than
>= Greater than or Equal to
<= Less than or Equal to
== Equal to one equal (=) sign is used as
assignment operator
!= Not equal
RELATIONAL OPERATORS
Relational Operators age = 18; expenses = 5000
Symbol Examples income = 1000; payment = 200
bill = 300, grade=70, PASSWORD=12
> If age > 17; T F if expenses > income T F
< if grade < 75, T F if payment < bill T F
>= if age >= 18; T F if age>=75, T F if payment >= bill T F
<= if age <=17; T F if bill <= payment T F
= = if expenses == income; T F if payment==bill T F
!= if PASSWORD!=12345; T F
LOGICAL OPERATORS

Logical Operators
Symbol Name
&& And
|| Or
! Not
AND TRUTH TABLE
CONDITION 1 CONDITION 2

NO1 = 5, NO2 = 10, NO3 = 12, NO4 =5

If NO1 > 1 && NO2 < 9 RESULT =


If NO2 > 3 && NO4 < 6 RESULT =
If NO1 > NO2 && NO4 < NO3 RESULT =
If NO2 > NO3 && NO4 < NO1 RESULT =
OR TRUTH TABLE

CONDITION 1 CONDITION 2

NO1 = 5, NO2 = 10, NO3 = 12, NO4 =5

If NO1 > 1 || NO2 < 11 RESULT =


If NO2 > 3 || NO3 < 6 RESULT =
If NO1 > NO2 || NO4 < NO3 RESULT =
If NO2 > NO3 || NO4 < NO1 RESULT =
SAMPLE PROBLEM: Determine the
price of a tshirt depending on the input
quantity
QUANTITY PRICE
1 200 PESOS
2-10 180 PESOS
11-50 160 PESOS
> 50 (MORE THAN 50) 150 PESOS
OTHER LOGICAL OPERATORS
XOR, XNOR, NOR
►XOR XNOR NOR
►T T F T T T T T F
►T F T T F F T F F
►F T T F T F F T F
►F F F F F T F F T
CONVERSION OF CONDITIONS

You might also like