Welcome to
GITAM
Dept of CSE, GIT
Flowcharting
A flowchart is a visual representation of the sequence of steps and decisions needed
to perform a process or solve a problem.
In problem-solving, it helps break down complex tasks into manageable parts,
illustrating how each step flows into the next.
Flowcharts use standardized symbols to depict different types of actions, decisions,
inputs, and outputs, making it easier to understand and communicate the process.
Dept of CSE, GIT
Flowcharting(Contd…)
Key Components of a Flowchart:
I. Start/End (Oval): Represents the beginning and end of the process.
II. Process (Rectangle): Indicates a step or action in the process.
III. Decision (Diamond): Shows a point where a decision must be made, leading to
different branches based on the outcome.
Dept of CSE, GIT
Flowcharting(Contd…)
Key Components of a Flowchart:
IV. Input/Output (Parallelogram): Represents data entering or leaving the process.
V. Arrow (Connector): Demonstrates the flow of the process, showing the direction
from one step to the next.
VI. Subprocess (Rectangle with Double Stripes): Indicates a set of steps grouped into a
single process that can be broken down further.
Dept of CSE, GIT
Flowcharting(Contd…)
Example:
Dept of CSE, GIT
Flowcharting(Contd…)
Steps to Create a Flowchart for Problem Solving:
Identify the Problem: Clearly define the problem you need to solve.
Break Down the Process: Divide the process into smaller, manageable steps.
Decide on Key Decisions: Identify points where decisions need to be made.
Determine Inputs and Outputs: Identify the necessary inputs and the expected outputs.
Dept of CSE, GIT
Flowcharting(Contd…)
Steps to Create a Flowchart for Problem Solving:
Determine Inputs and Outputs: Identify the necessary inputs and the expected outputs.
Draw the Flowchart: Use the standardized symbols to represent each step, decision,
input, and output. Connect these symbols with arrows to show the process flow.
Review and Refine: Check the flowchart for completeness and accuracy. Make the
adjustments if necessary.
Dept of CSE, GIT
Decision Tables in Flowchart
A decision table is a structured format to represent complex decision logic. It lists:
Conditions: Situations or inputs that influence the decision.
Actions: Steps or outputs based on the conditions.
Rules: Combinations of conditions leading to specific actions.
Structure of a Decision Table:
Columns: Represent conditions and their possible states (e.g., True/False).
Rows: Specify the action(s) triggered by those conditions.
Dept of CSE, GIT
Decision Tables in Flowchart(Contd…)
Condition 1 Condition 2 Action 1 Action 2
TRUE FALSE Yes No
FALSE TRUE No Yes
Program?
Dept of CSE, GIT
Algorithm
An algorithm is a step-by-step procedure or set of rules designed to perform a specific
task or solve a particular problem.
Clear and Well-Defined Steps: An algorithm consists of a sequence of precise
instructions, ensuring that each step is clearly defined and executable. This makes it
easy to follow and implement.
Deterministic: For a given input, an algorithm should consistently produce the same
output, providing predictability and reliability in its results.
Dept of CSE, GIT
Algorithm(Contd…)
Efficiency: The performance of an algorithm is measured by its efficiency, which includes
time complexity (how fast it runs) and space complexity (how much memory it uses).
Efficient algorithms perform tasks quickly and use minimal resources.
Termination: A good algorithm must terminate after a finite number of steps. It should not
run indefinitely and must eventually produce an output or a solution.
Generality: An algorithm should be designed to solve a general problem or a class of
problems, not just a single instance. It should be adaptable to different inputs and scenarios
while maintaining its functionality.
Dept of CSE, GIT
Algorithm(Contd…)
Example Algorithm:
Start
Input three numbers num1, num2, num3.
Calculate the sum of the three numbers: sum = num1 + num2 + num3.
Compute the average: average = sum / 3.
Output the value of average.
End
Dept of CSE, GIT
Algorithm VS Flowchart VS Pseudocode
Feature Algorithm Flowchart Pseudocode
Representation Textual and detailed Graphical representation Textual description resembling
step-by-step instructions. using symbols and structured programming languages.
arrows.
Detail Level High detail with precise Visual and often less Moderate detail, focusing on logic
operations. detailed, focusing on without strict syntax.
process flow.
Ease of May require more effort Easier to understand Easier to write and understand than
Understanding to follow due to textual visually, especially for full code, but not as visual as
nature. complex processes. flowcharts.
Dept of CSE, GIT
Structured Programming
Structured programming is a programming paradigm that emphasizes the use of clear,
structured control flow, avoiding reliance on goto statements, and promoting readability
and maintainability.
Python, as a high-level programming language, inherently supports structured
programming through its features and syntax.
Key Features:
i) Modularity
ii) Control Flow Structures
Dept of CSE, GIT
Structured Programming(Contd…)
iii) Avoiding goto
iv) Error Handling
v) Readability and Indentation
Dept of CSE, GIT
Programming Methodologies
Top-Down and Bottom-Up methodologies are contrasting approaches to software
development and problem-solving in programming.
They dictate how a system is analyzed, designed, and implemented, impacting the
development process and the structure of code.
i) Top-down Approach:
The Top-Down methodology starts with breaking down a high-level problem or system
into smaller, more manageable parts.
Focuses on the big picture first, defining overall functionality, and gradually moving to
implementation details.
Dept of CSE, GIT
Programming Methodologies(Contd…)
Suited for procedural and structured programming languages like C, Pascal, or Python.
Code is structured using functions, procedures, or modules.
Advantages:
Clear focus on system design: Ensures a well-thought-out overall structure.
Easier debugging: Errors are easier to trace back to the higher-level logic.
Enhanced readability: Abstract concepts are clearly defined before implementation.
Dept of CSE, GIT
Programming Methodologies(Contd…)
ii) Bottom-Up Approach:
The Bottom-Up methodology begins with building low-level components or modules
and integrating them into higher-level systems.
Focuses on detail-oriented implementation first, gradually assembling the bigger
picture. Common in object-oriented programming languages like C++, Java, or Python.
Advantages:
Reusability: Individual components can be reused across projects.
Easier testing: Each module can be tested independently before integration.
Flexibility: Changes in lower-level modules don’t always impact the higher levels.
Dept of CSE, GIT
Programming Methodologies(Contd…)
Aspect Top-Down Bottom-Up
Low-level implementation first,
Focus High-level design first, details later
system later
Procedural/Structured
Best Suited For Object-Oriented Programming
Programming
Integration testing after top
Testing Unit testing of low-level components
modules
Design Process Decomposition of tasks Composition of reusable components
Less flexible to changes during
Flexibility More flexible due to modularity
development
Dept of CSE, GIT
Example Programs on If Condition
1. Write an algorithm and Python code to check if a number is positive, negative, or zero.
2. Write an algorithm to input two numbers and print the larger one.
3. Write an algorithm to check whether a given year is Leap year or Not.
4. Write an algorithm to find area & circumference of circle.
5. Write an algorithm to convert Fahrenheit to Centigrade.
6. Write an algorithm to swap to two numbers without using temporary variable.
7. Write an algorithm to accept 4 digit numbers from keyboard and obtain sum of its digits.
8. Write an algorithm to accept 4 digit numbers and print reveres the number.
9. Write an algorithm to accept a numbers from keyboard and print the value of ten’s place.
Dr. Riju Bhattacharya, Dept. of CSE, Programming for Problem Solving - 2
Example Programs on Loops
1. Draw a Flowchart to calculate factorial of given number.
2. Design a flowchart and program to find the largest of three numbers.
3. Create a flowchart that takes a number as input and checks if it is prime.
4. Draw a flowchart to print the Fibonacci sequence up to a given number.
5. Draw a flowchart to solve a quadratic equation using Python.
6. Draw a flowchart to check whether the last digit of two numbers are same or not.
7. Draw a flowchart to find the sum of all integers up to a given number using a for loop.
8. Create a flowchart for a Python program to check if a string is a palindrome.
9. Draw a flowchart to print the multiplication table of a given number.
[Link] a flowchart to calculate the greatest common divisor (GCD) of two numbers.
[Link] a flowchart program to count the number of vowels in a given string.
Dr. Riju Bhattacharya, Dept. of CSE, Programming for Problem Solving - 2
Example Programs on Functions
1. Draw a flow chart to input a number . if the number is even, display the square otherwise print
its cube.
2. Draw a flowchart to calculate the area of a circle using a function.
3. Draw a flowchart to find largest among three numbers using function.
4. Draw a flowchart function to find the factorial of a number.
5. Draw a flowchart with a function that determines whether a number is Armstrong or not.
6. Draw a flowchart that uses a function to reverse a string.
Dr. Riju Bhattacharya, Dept. of CSE, Programming for Problem Solving - 2
Sample Programs
TASK 1: TASK 2:
Dept of CSE, GIT
Sample Programs
TASK 3: Program to find N term of Fibonacci sequence
TASK 4: Program to check whether a number is palindrome or not
TASK 5: Program to compute the reverse of a number
TASK 6: Program to find the number of even numbers in a sequence of elements (list)
Dept of CSE, GIT
Thank You