Computer and Programming Concepts
Computer and Programming Concepts
Programming Concepts
Arrows/Flow Connector
Lines
TERMINAL SYMBOL
• Indicates the starting or ending of the program.
• A flowchart can ONLY have ONE STARTING POINT, but it may have MANY
possible STOPPING POINTS.
INPUT / OUTPUT SYMBOL
• This parallelogram is used for INPUT and OUTPUT instructions.
• Input means to enter data into a computer or to use the computer to read
available data from storage drives.
• Output means to display the result of compilation or condition of the given
solution.
PROCESS SYMBOL
• This rectangle is used for any data processing operations for which
requirements of the problem are usually done here.
• Indicates any type of internal operations like initialization, calculations, etc.
DECISION SYMBOL
• This diamond-shaped symbol contains a condition.
• Used for asking questions that can have either TRUE (Yes) or FALSE (No) as
an answer.
CONNECTOR SYMBOL
• It is used as continuation symbol of a flowchart in the page.
• It is also used to indicate the point of entry and point of exit of repetition.
ARROWS / FLOW LINES
• Arrows are used to direct the flow of the flowchart.
• It shows the flow of the solution.
FLOWCHART DEVELOPMENT
• The step that comprise a flowchart must be organize in an orderly,
understandable and clear manner so that the program that implements
this flowchart is similarly in an orderly, understandable, and clear manner.
• It is called Structured Flowchart.
• Structured flowcharts are designed using the three basic control structures:
1. Sequential
2. Selection
3. Repetition
SEQUENTAL STRUCTURE
• Steps are performed in a strictly sequential manner.
• Each step being executed exactly once.
• It is the simplest method of control.
• It is easy to develop and understand.
SELECTION STRUCTURE
• One of several alternative actions is selected and executed.
• It involves the use of decision based on the given condition.
• It uses decision block or the diamond shaped block.
• Alternative action will be represented by a processing block.
REPETITION STRUCTURE
• One or more steps performed repeatedly (looping).
FLOWCHART RULES
• Flowchart is generally drawn from top to bottom.
• All boxes of flowchart must be connected with arrow lines.
• All flowchart starts with a terminal or process symbol.
• Decision symbol have 2 exit points, one for Yes (True) and another
for No (False).
Key Elements of Program Logic Formulation
Pseudocode Writing
• Pseudocode is an informal human-readable way of describing the steps of a
program.
• It is used to outline a program’s logic before writing actual code.
• Pseudocode uses simple language and avoids specific syntax, making it accessible
for both programmers and non-programmers.
Benefits of Pseudocode:
• Simplicity: It focuses on the logic rather than the syntax of a specific programming
language.
• Clarity: It can be used to explain program logic to stakeholders who may not know
programming languages.
• Versatility: It can be easily converted to code in any programming language.
Key Elements of Program Logic Formulation
Pseudocode Writing
Example of Pseudocode:
• Here’s pseudocode for finding the largest number in a list:
Key Elements of Program Logic Formulation
Testing and Debugging
• Once the program logic is formulated and the code is written, it needs to be
tested and debugged.
• Testing ensures the program work as expected, while debugging involves
identifying and fixing errors in the logic or code.
• Unit Testing: Testing individual parts (function, modules) of the program to
ensure they work as intended.
• Integration Testing: Testing how different parts of the program work together.
• User Acceptance Testing (UAT): Ensuring the program meets the user’s
requirements.
Key Elements of Program Logic Formulation
Testing and Debugging
• Debugging involves using techniques like:
• Print statements: Adding statement to print out variable values and flow steps.
• Debugging tools: Using tools to step through code, check memory usage, and
identify logic flaws.
• Error logs: Reviewing logs generated during program execution to locate errors.
Important Concepts in Program Logic Formulation
• Sequential Logic: Steps are executed one after another in a defined
sequence.
• Conditional Logic: Certain steps are executed based on conditions (e.g.
if-else statements).
• Looping/Iteration: Repeating a set of steps multiple times (e.g. while loops,
for loops).
• Modular Design: Breaking the program into smaller, reusable units or
modules (function, procedures) that solve specific parts of the problem.
• Recursion: A method where a function calls itself to solve a problem in a
smaller scope, often used for problems that can be divided into
sub-problems.
Techniques for Improving Program Logic
1. Top-Down Design (Stepwise Refinement)
• Break the problem into smaller parts, solve each part independently, and then
combine them to form the overall solution.
• Start with high-level solution and gradually refine it into more detailed steps.
2. Dry Run
• Manually simulate the execution of the logic by stepping through the code or
pseudocode and tracking variable on paper.
• Helps identify errors early before testing.
3. Optimization
• After formulating the initial logic, revisit program to optimize it for efficiency
(speed, memory usage).
• Consider simplifying loops, reducing redundant operations, or improving
algorithmic complexity.
Algorithm that shows the
printing of the SUM
Overview of
Programming and
Software Development
What is Programming?
• Programming involves creating a set of instructions for a
computer to follow in order to perform tasks or solve
problems.
• It is used to automate processes, solve complex problems,
and create software applications.
Software Development Life Cycle (SDLC)
Phases of SDLC
• Requirement Analysis : Identifying what needs to be built.
• Design : Planning how the solution will be structured.
• Implementation : Writing the actual code.
• Testing : Ensuring the code works as expected.
• Deployment : Releasing the software for use.
• Maintenance : Updating and fixing the software as needed.
Introduction to C Language
• Developed in the early 1970s by Dennis Ritchie at Bell labs.
Features:
• Low-Level Access : Allows direct interaction with memory
and hardware.
• Portability : Can be compiled on various platforms.
• Efficiency : Provides high performance and fine control over
system resources.
Why Learn C?
• C serves as the basis for many other languages such as C++,
Java, etc.
• In terms of performance C is efficient and powerful, suitable
for systems programming.
• It is used in a wide range of applications from system
software to game development.
Introduction to the Programming
Environment
• Dev-C++ is an integrated development environment (IDE)
primarily used for C and C++ programming.
• It includes the MinGW (Minimalist GNU for Windows)
compiler, which allows developers to compile and run C/C++
code in Windows environment.
• It can be suitable option due to its simplicity and ease of use.
Writing and Running C Programs
Hello World Program
• #include <stdio.h>: Includes the standard library for input and output functions.
• int main(): The main function where the program execution begins.
• printf(“Hello, World!\n”);: Outputs the string “Hello, World!” to the console.
• return 0;: Indicates successful completion of the program.
Debugging Common Issues
Syntax Errors: Errors in the code such as missing semicolons
or incorrect syntax.
Logica Errors: Issues with the program logic or incorrect
results.
Runtime Errors: Errors that occur during execution, such as
division by zero.
Tips for Writing Good Code
Commenting: Use comments to describe code functionality.
Indentation: Ensure consistent indentation for readability.
Variable Names: Choose descriptive names for variables.
Supplementary
Material
RAM VS ROM
SECONDARY MEMORY
Thank you and
STAY SAFE!
Do you have any questions?