SlideShare a Scribd company logo
Dr. Jeetashree Aparajeeta
Assistant Professor (Sr)
SENSE
 Introduction to Problem Solving
◦ Problem Solving: Definition and Steps
◦ Problem Analysis Chart
◦ Developing an Algorithm
◦ Flowchart
◦ Pseudocode
2
 Use of computer technology help in completing any
task in a much faster and accurate manner.
 Ex. Paying electric bill, booking a health check up,
ordering your favorite food, booking movie tickets
etc.
 These technologies follow a proper problem
solving approach for an essential skill to solve the
related problems.
 Ex. You cannot order food using Apollo247 App.
3
 The standard computers, that we use, are not
advance enough to solve a problem of their own,
so we need to feed step-by-step instructions to
the computer to solve any problem.
 The efficiency in solving the problem depends
upon how correctly and precisely we define the
problem, design a solution (algorithm) and
implement the solution (program) using a
programming language.
4
 So, the problem solving can be defined as the
process of identifying a problem, developing an
algorithm for the identified problem and finally
implementing the algorithm to develop a
computer program.
5
 The correctness of the output that a computer gives
depends upon the correctness of input provided.
 Key steps required for solving a problem
I. Analyzing the problem
II. Developing an algorithm
a. Flowchart
b. Pseudocode
III. Coding
IV. Testing and Debugging
6
Analysing the problem
It is important to clearly understand a problem before
we begin to find the solution for it. If we are not clear
as to what is to be solved, we may end up developing
a program which may not solve our purpose. Thus,
we need to read and analyse the problem statement
carefully in order to list the principal components of
the problem and decide the core functionalities that
our solution should have. By analysing a problem, we
would be able to figure out what are the inputs that
our program should accept and the outputs that it
should produce
4.2.1 Analysing the problem
It is important to clearly understand a problem before
we begin to find the solution for it. If we are not clear
as to what is to be solved, we may end up developing
a program which may not solve our purpose. Thus,
we need to read and analyse the problem statement
carefully in order to list the principal components of
the problem and decide the core functionalities that
our solution should have. By analysing a problem, we
would be able to figure out what are the inputs that
our program should accept and the outputs that it
should produce.
4.2.2 Developing an Algorithm
It is essential to device a solution before writing a
program code for a given problem. The solution is
represented in natural language and is called an
algorithm. We can imagine an algorithm like a very
well-written recipe for dish.
We start with a tentative solution plan and keep
on refining the algorithm until the algorithm is able
to capture all the aspects of the desired solution. For
a given problem, more than one algorithm is possible
and we have to select the most suitable solution
 4.2.3 Coding
 After finalising the algorithm, we need to
convert the algorithm into the format which
can be understood by the computer to
generate the desired solution. Different
 high level programming languages can be
used for writing a program
4.2.4 Testing and Debugging
The program created should be tested on
various parameters. The program should meet
the requirements of the user. It must respond
within the expected time. It should generate
correct output for all possible inputs. In the
presence of syntactical errors, no output will
be obtained. In case the output generated is
incorrect, then the program should be checked
for logical errors, if any.
33
Separate the problem into
three components
Input
A list of data source
Provided to the problem
Output
A list of the output
required
Processing
A list of actions needed
to produce the required
outputs.
 PAC is used to analyze a problem.
 It has four sections:
a. The given data
b. The required result
c. The processing involved
d. A list of solution alternative
34
Given Data Required result
Section 1
Data given in the
problem/ provided by the
user
Section 2
Requirements for the
output reports including
the information needed
and the format required
Processing Required Solution Alternative
Section 3
List of processing
required including
equations or other types
of processing.
Section 4
List of ideas for the
solution of the problem
35
 Problem:
 A program is required to find average of five
numbers.
36
37
Given Data Required result
Number 1
Number 2
Number 3
Number 4
Number 5
Average of 5 numbers
Processing Required Solution Alternative
Total = Number 1 +
Number 2 + Number 3 +
Number 4 + Number 5
Average = Total / 5
i. Define the numbers as
constants
ii. Define the numbers as
input values
 Total = 5 + 6 + 8 + 9 + 11
Or
 Number 1 = 5, Number 2 = 6, Number 3 = 8,
Number 4 = 9, Number 5 = 11
Or
 Number = “Ask the user to provide the
number”
38
 Calculate the gross pay of an employee. The
formula to be used : GrossPay = Hours x
Payrate
39
40
Given Data Required result
Hours
PayRate
Gross Pay
Processing Required Solution Alternative
GrossPay = Hours * PayRate 1. Define the hours worked and
Payrate as constant
2. Define the hours worked and
PayRate as input
 Convert the distance in KM to miles where 1
mile = 1.609 km
41
42
Given Data Required result
Distance in km Distance in mile
Processing Required Solution Alternative
Mile = km/1.609 1. Define the km as constant
2. Define the km as input
 An algorithm is an effective method expressed as
a finite list of well defined instructions for
calculating a function, starting from an initial
state and initial input.
 The instructions describe a computation, which
will eventually produce output, when executed.
 Algorithm can be used to solve any kind of
problems.
 However, before writing a program, we need to
write the steps to solve the problem in simple
English language. This step-by-step procedure
to solve the problem is called algorithm.
43
 The way of execution of program is
categorized as
◦ Sequence Statements
◦ Selection Statements
◦ Iteration or Looping Statements (Called Control
Structure)
44
 In this program, all the instructions are
executed one after another.
 Ex: Algorithm to find the area of a rectangle
◦ Step 1: Start
◦ Step 2: Take length and breadth and store them as
L and B
◦ Step 3: Multiply by L and B and store it in Area
◦ Step 4: Print Area
◦ Step 5: Stop
45
 In this type of programming, some portion of
the program is executed based upon the
conditional test.
 If the conditional test is true, compiler will
execute some part of the program, otherwise
it will execute the other part of the program.
46
 Ex: Algorithm to check whether a candidate is
eligible to vote?
◦ Step 1: Start
◦ Step 2: Take age and store it in Age
◦ Step 3: Check Age value, if age > 18, then go to
step-4 else Step-5
◦ Step 4: Print “Eligible to Vote” and go to Step-6
◦ Step 5: Print “Not Eligible to Vote”
◦ Step 6: Stop
47
 Two common methods are used to represent
an algorithm
a. Flowchart
b. Pseudocode
 Either of the methods can be used to represent
an algorithm.
48
 The flowchart and pseudocode showcases the
logic of the solution required to solve the
problem excluding any implementation details.
 We can understand the flow of control during
execution of the program.
49
 Visual representation of an algorithm
 It is a diagram made up of boxes, diamonds
and other shapes, connected by arrows.
 Each shape represents a step of the solution
process and the arrow represents the order or
link among the steps.
50
A flow chart is an
organized
combination of shapes,
lines and text that
graphically illustrate a
process or structure.
51
 Write an algorithm to find the square of a
number
52
 Before developing the algorithm, first identify
the input, process and output.
◦ Input: Number whose square is required
◦ Process: Multiply the number by itself to get its
square
◦ Output: Square of the number
53
 Step 1: Input a number and stored it to Number
(Number is a variable)
 Step 2: Compute Number * Number and store it
in Square (Square is a variable)
 Step 3: Print Square
54
55
56
 Pseudocode is another way of representing an algorithm.
 It is a kind of structured English for describing algorithms
 It allows the designer to focus on the logic of the algorithm
without being distracted by details of language syntax
 Pseudocode needs to be complete
 It describe the entire logic of the algorithm so that
implementation becomes a rote mechanical task of
translating line by line into source code
57
 Each instruction is written on a separate line
 Keywords and indentation are used to signify
particular control structures
 Each set of instructions is written from top to
bottom, with only one entry and one exit
 Groups of statements may be formed into modules,
and that group given a name.
58
 Several keywords are often used to indicate
common input, output, and processing
operations
 Input: READ, OBTAIN, GET
 Output: PRINT, DISPLAY, SHOW
 Compute: COMPUTE, CALCULATE, DETERMINE
 Initialize: SET, INIT
 Add one: INCREMENT, BUMP, DECREMENT
59
 Area of Rectangle.
60
 READ height of Rectangle
 READ width of Rectangle
 COMPUTE area as height times width
 PRINT area of rectangle
61
 Format
IF Condition THEN
Statements
ELSE
Statement
ENDIF
 Example
IF Hours_Worked > Normal_Max THEN
Display overtime message
ELSE
Display regular time message
ENDIF
63
 Format
WHILE Condition
Statements
ENDWHILE
 Example
WHILE Population < Limit
Compute Population as Population + Births ‐ Deaths
ENDWHILE
64
 Format
FOR Iteration Bounds
Statements
ENDFOR
 Example
FOR each student in the list
Print Register_Number
ENDFOR
65
67

More Related Content

Similar to Module 1 python.pptx

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
MMRF2
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
ssuser586772
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
Hattori Sidek
 

Similar to Module 1 python.pptx (20)

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
Practical 01 (detailed)
Practical 01 (detailed)Practical 01 (detailed)
Practical 01 (detailed)
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
C++ good tutorial
C++ good tutorialC++ good tutorial
C++ good tutorial
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Software develop....
Software develop.... Software develop....
Software develop....
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
Software Development
Software DevelopmentSoftware Development
Software Development
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.ppt
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
PCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptxPCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptx
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
FIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programFIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer program
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 

Recently uploaded

Recently uploaded (20)

Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 

Module 1 python.pptx

  • 1. Dr. Jeetashree Aparajeeta Assistant Professor (Sr) SENSE
  • 2.  Introduction to Problem Solving ◦ Problem Solving: Definition and Steps ◦ Problem Analysis Chart ◦ Developing an Algorithm ◦ Flowchart ◦ Pseudocode 2
  • 3.  Use of computer technology help in completing any task in a much faster and accurate manner.  Ex. Paying electric bill, booking a health check up, ordering your favorite food, booking movie tickets etc.  These technologies follow a proper problem solving approach for an essential skill to solve the related problems.  Ex. You cannot order food using Apollo247 App. 3
  • 4.  The standard computers, that we use, are not advance enough to solve a problem of their own, so we need to feed step-by-step instructions to the computer to solve any problem.  The efficiency in solving the problem depends upon how correctly and precisely we define the problem, design a solution (algorithm) and implement the solution (program) using a programming language. 4
  • 5.  So, the problem solving can be defined as the process of identifying a problem, developing an algorithm for the identified problem and finally implementing the algorithm to develop a computer program. 5
  • 6.  The correctness of the output that a computer gives depends upon the correctness of input provided.  Key steps required for solving a problem I. Analyzing the problem II. Developing an algorithm a. Flowchart b. Pseudocode III. Coding IV. Testing and Debugging 6
  • 7.
  • 8. Analysing the problem It is important to clearly understand a problem before we begin to find the solution for it. If we are not clear as to what is to be solved, we may end up developing a program which may not solve our purpose. Thus, we need to read and analyse the problem statement carefully in order to list the principal components of the problem and decide the core functionalities that our solution should have. By analysing a problem, we would be able to figure out what are the inputs that our program should accept and the outputs that it should produce
  • 9. 4.2.1 Analysing the problem It is important to clearly understand a problem before we begin to find the solution for it. If we are not clear as to what is to be solved, we may end up developing a program which may not solve our purpose. Thus, we need to read and analyse the problem statement carefully in order to list the principal components of the problem and decide the core functionalities that our solution should have. By analysing a problem, we would be able to figure out what are the inputs that our program should accept and the outputs that it should produce.
  • 10. 4.2.2 Developing an Algorithm It is essential to device a solution before writing a program code for a given problem. The solution is represented in natural language and is called an algorithm. We can imagine an algorithm like a very well-written recipe for dish. We start with a tentative solution plan and keep on refining the algorithm until the algorithm is able to capture all the aspects of the desired solution. For a given problem, more than one algorithm is possible and we have to select the most suitable solution
  • 11.  4.2.3 Coding  After finalising the algorithm, we need to convert the algorithm into the format which can be understood by the computer to generate the desired solution. Different  high level programming languages can be used for writing a program
  • 12. 4.2.4 Testing and Debugging The program created should be tested on various parameters. The program should meet the requirements of the user. It must respond within the expected time. It should generate correct output for all possible inputs. In the presence of syntactical errors, no output will be obtained. In case the output generated is incorrect, then the program should be checked for logical errors, if any.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. 33 Separate the problem into three components Input A list of data source Provided to the problem Output A list of the output required Processing A list of actions needed to produce the required outputs.
  • 34.  PAC is used to analyze a problem.  It has four sections: a. The given data b. The required result c. The processing involved d. A list of solution alternative 34
  • 35. Given Data Required result Section 1 Data given in the problem/ provided by the user Section 2 Requirements for the output reports including the information needed and the format required Processing Required Solution Alternative Section 3 List of processing required including equations or other types of processing. Section 4 List of ideas for the solution of the problem 35
  • 36.  Problem:  A program is required to find average of five numbers. 36
  • 37. 37 Given Data Required result Number 1 Number 2 Number 3 Number 4 Number 5 Average of 5 numbers Processing Required Solution Alternative Total = Number 1 + Number 2 + Number 3 + Number 4 + Number 5 Average = Total / 5 i. Define the numbers as constants ii. Define the numbers as input values
  • 38.  Total = 5 + 6 + 8 + 9 + 11 Or  Number 1 = 5, Number 2 = 6, Number 3 = 8, Number 4 = 9, Number 5 = 11 Or  Number = “Ask the user to provide the number” 38
  • 39.  Calculate the gross pay of an employee. The formula to be used : GrossPay = Hours x Payrate 39
  • 40. 40 Given Data Required result Hours PayRate Gross Pay Processing Required Solution Alternative GrossPay = Hours * PayRate 1. Define the hours worked and Payrate as constant 2. Define the hours worked and PayRate as input
  • 41.  Convert the distance in KM to miles where 1 mile = 1.609 km 41
  • 42. 42 Given Data Required result Distance in km Distance in mile Processing Required Solution Alternative Mile = km/1.609 1. Define the km as constant 2. Define the km as input
  • 43.  An algorithm is an effective method expressed as a finite list of well defined instructions for calculating a function, starting from an initial state and initial input.  The instructions describe a computation, which will eventually produce output, when executed.  Algorithm can be used to solve any kind of problems.  However, before writing a program, we need to write the steps to solve the problem in simple English language. This step-by-step procedure to solve the problem is called algorithm. 43
  • 44.  The way of execution of program is categorized as ◦ Sequence Statements ◦ Selection Statements ◦ Iteration or Looping Statements (Called Control Structure) 44
  • 45.  In this program, all the instructions are executed one after another.  Ex: Algorithm to find the area of a rectangle ◦ Step 1: Start ◦ Step 2: Take length and breadth and store them as L and B ◦ Step 3: Multiply by L and B and store it in Area ◦ Step 4: Print Area ◦ Step 5: Stop 45
  • 46.  In this type of programming, some portion of the program is executed based upon the conditional test.  If the conditional test is true, compiler will execute some part of the program, otherwise it will execute the other part of the program. 46
  • 47.  Ex: Algorithm to check whether a candidate is eligible to vote? ◦ Step 1: Start ◦ Step 2: Take age and store it in Age ◦ Step 3: Check Age value, if age > 18, then go to step-4 else Step-5 ◦ Step 4: Print “Eligible to Vote” and go to Step-6 ◦ Step 5: Print “Not Eligible to Vote” ◦ Step 6: Stop 47
  • 48.  Two common methods are used to represent an algorithm a. Flowchart b. Pseudocode  Either of the methods can be used to represent an algorithm. 48
  • 49.  The flowchart and pseudocode showcases the logic of the solution required to solve the problem excluding any implementation details.  We can understand the flow of control during execution of the program. 49
  • 50.  Visual representation of an algorithm  It is a diagram made up of boxes, diamonds and other shapes, connected by arrows.  Each shape represents a step of the solution process and the arrow represents the order or link among the steps. 50
  • 51. A flow chart is an organized combination of shapes, lines and text that graphically illustrate a process or structure. 51
  • 52.  Write an algorithm to find the square of a number 52
  • 53.  Before developing the algorithm, first identify the input, process and output. ◦ Input: Number whose square is required ◦ Process: Multiply the number by itself to get its square ◦ Output: Square of the number 53
  • 54.  Step 1: Input a number and stored it to Number (Number is a variable)  Step 2: Compute Number * Number and store it in Square (Square is a variable)  Step 3: Print Square 54
  • 55. 55
  • 56. 56
  • 57.  Pseudocode is another way of representing an algorithm.  It is a kind of structured English for describing algorithms  It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax  Pseudocode needs to be complete  It describe the entire logic of the algorithm so that implementation becomes a rote mechanical task of translating line by line into source code 57
  • 58.  Each instruction is written on a separate line  Keywords and indentation are used to signify particular control structures  Each set of instructions is written from top to bottom, with only one entry and one exit  Groups of statements may be formed into modules, and that group given a name. 58
  • 59.  Several keywords are often used to indicate common input, output, and processing operations  Input: READ, OBTAIN, GET  Output: PRINT, DISPLAY, SHOW  Compute: COMPUTE, CALCULATE, DETERMINE  Initialize: SET, INIT  Add one: INCREMENT, BUMP, DECREMENT 59
  • 60.  Area of Rectangle. 60
  • 61.  READ height of Rectangle  READ width of Rectangle  COMPUTE area as height times width  PRINT area of rectangle 61
  • 62.
  • 63.  Format IF Condition THEN Statements ELSE Statement ENDIF  Example IF Hours_Worked > Normal_Max THEN Display overtime message ELSE Display regular time message ENDIF 63
  • 64.  Format WHILE Condition Statements ENDWHILE  Example WHILE Population < Limit Compute Population as Population + Births ‐ Deaths ENDWHILE 64
  • 65.  Format FOR Iteration Bounds Statements ENDFOR  Example FOR each student in the list Print Register_Number ENDFOR 65
  • 66.
  • 67. 67

Editor's Notes

  1. Flow Charts are used to help programmers during the early stages of programming. Flow Charts allow the programmer to set out, in a very simple way the sequence that he/she wants for each line of the program. A flow chart is an organized combination of shapes, lines and text that graphically illustrates a process or structure. Here's an example of how you could use shapes, lines, and text to build a chart: • The shapes (such as rectangles, circles, or diamonds) represent each step or decision point in the process. • The lines show the continuity of the process, demonstrating the paths the user should follow. • The text briefly describes each part of the process. A flow chart can be used for: (1) defining and analyzing processes (2) building a step-by-step picture of the process for analysis, discussion, or communication purposes (3) defining, standardizing, or finding areas for improvement in a process