SlideShare a Scribd company logo
18
Most read
19
Most read
20
Most read
Programming For Problem
Solving (PFPS)
LECTURE 1
Introduction to Algorithms and
Flowcharts
Algorithms and Flowcharts
• Algorithm and flowchart are the powerful tools
for learning programming
• An algorithm is a step-by-step analysis of the
process, while a flowchart explains the steps of a
program in a graphical way.
• Algorithm and flowcharts helps to clarify all the
steps for solving the problem.
• For beginners, it is always recommended to
first write algorithm and draw flowchart for
solving a problem and then only write the
program.
2
Algorithms
• A typical programming task can be divided into two
phases:
• Problem solving phase
– Produce an ordered sequence of steps that describe
solution of problem
– This sequence of steps is called an algorithm
– An algorithm is a sequence of steps to solve a particular
problem
– An algorithm is defined as an ordered set of unambiguous
steps that produces a result and terminates in a finite time
• Implementation phase
– Implement the program in some programming language
3
Steps In Problem Solving
• First produce a general algorithm called
pseudocode.
• Pseudocode is an artificial and informal
language that is very similar to everyday
English. It helps programmers develop
algorithms.
• Refine the algorithm successively to get step
by step detailed algorithm that is very close to
a computer language.
4
Characteristics of an Algorithm
• Algorithm has the following characteristics
– Input: An algorithm may or may not require input
– Output: Each algorithm is expected to produce at
least one result
– Definiteness: Each instruction must be clear and
unambiguous.
– Finiteness: If the instructions of an algorithm are
executed, the algorithm should terminate after
finite number of steps
5
Control Structures Involved In
Algorithm and Flowchart
• The algorithm and flowchart include following three
types of control structures.
– Sequence: In the sequence structure, statements are
placed one after the other and the execution takes place
starting from up to down.
– Branching (Conditional): In branch control, there is a
condition and according to a condition, a decision of
either TRUE or FALSE is achieved. In the case of TRUE, one
of the two branches is explored; but in the case of
FALSE condition, the other alternative is taken. Generally,
the ‘IF-THEN’ construct is used to represent branch
control.
– Loop (Repetition): The Loop or Repetition allows a
statement(s) to be executed repeatedly based on certain
loop condition using WHILE, Do-WHILE and FOR loops.
6
Example of Pseudocode and Algorithm
• Example 1: Write the pseudocode and detailed algorithm
to determine a student’s final grade and indicate whether
the student is passing or failing. The final grade is
calculated as the average of four marks.
• Pseudocode:
– Input a set of 4 marks
– Calculate their average by adding the marks and
dividing the sum by 4
– if average is below 50
Print “FAIL”
else
Print “PASS
7
Example of Pseudocode and Algorithm
• Detailed Algorithm
– Step 1: Input M1,M2,M3,M4
– Step 2: GRADE = (M1+M2+M3+M4)/4
– Step 3: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
endif
8
Advantages of Algorithm
• It is a step-wise representation of a solution to a
given problem, which makes it easy to
understand.
• An algorithm uses a definite procedure.
• It is not dependent on any programming
language, so it is easy to understand for anyone
even without programming knowledge.
• Every step in an algorithm has its own logical
sequence so it is easy to debug.
9
Flowchart
• Flowchart is defined as a diagrammatic /graphical
representation of sequence of steps to solve a
problem.
• By looking at a flowchart, any one can easily
understand the operations and sequence of steps
involved in the solution
• Flowchart is often considered as a blueprint of a
design used for solving a specific problem
• Different symbols are used to draw each type of
flowchart.
10
Advantages of Flowchart
• Flowchart is an excellent way of communicating the logic of a
program.
• It provides an easy and efficient way to analyze the solution to
a problem.
• During program development cycle, the flowchart plays the
role of a blueprint, which makes the program development
process easier.
• After successful development of a program, it needs
continuous timely maintenance during the course of its
operation. The flowchart makes program or system
maintenance easier.
• It is easy to convert the flowchart into any programming
language code.
11
12
Standard Symbols Used in a Flowchart
Control Structures Representation in
Flowchart
13
Symbols Used in Algorithm and
Flowchart
• Assignment Symbol (← or =) is used to assign
value to the variable. E.g., to assign value 5 to
the variable HEIGHT, statement is HEIGHT ← 5
or HEIGHT = 5
• The symbol ‘=’ is used in most of the
programming language as an assignment symbol,
the same has been used in all the algorithms and
flowcharts in the manual
• The statement C = A + B means that add the
value stored in variable A and variable B then
assign/store the value in variable C
14
15
16
17
GO TO statement is also called unconditional transfer of
control statement is used to transfer control of execution to
another step/statement. E.g. the statement GOTO n will
transfer control to step/statement n.
Note: We can use keyword INPUT or READ or GET to accept
input(s) /value(s) and keywords PRINT or WRITE or DISPLAY
to output the result(s).
Sequential: Algorithm and Flowchart
18
19
Branching (Selection): Algorithm and
Flowchart
Looping: Algorithm and Flowchart
20

More Related Content

PPTX
Eucledian algorithm for gcd of integers and polynomials
PPTX
Unit1 principle of programming language
PDF
Syntax analysis
PPTX
Introduction of c programming
DOCX
some basic C programs with outputs
PPT
Game Playing in Artificial Intelligence
PDF
Problem Solving Techniques and Introduction to C
PPTX
Design and Analysis of Algorithms Lecture Notes
Eucledian algorithm for gcd of integers and polynomials
Unit1 principle of programming language
Syntax analysis
Introduction of c programming
some basic C programs with outputs
Game Playing in Artificial Intelligence
Problem Solving Techniques and Introduction to C
Design and Analysis of Algorithms Lecture Notes

What's hot (20)

PDF
Syntax directed translation
PPTX
data Structure
PPTX
Discrete mathematics presentation
PPTX
Structure in C
PPTX
Introduction to Data Structure & algorithm
PPTX
Chapter 5
PPT
BCS302- Digital Design and computer organization -VTU-2022 scheme-Expectation...
PPTX
Finaal application on regular expression
PPTX
COMPILER DESIGN
PPTX
PPTX
Analytical learning
PDF
Logic programming (1)
PDF
Principles of programming languages. Detail notes
PPTX
Ch.1 oop introduction, classes and objects
PPT
Asymptotic analysis
PPTX
Inheritance in c++
PPTX
Prolog Programming : Basics
PPTX
fundamentals of c
PPTX
Id3,c4.5 algorithim
PPTX
Translation of expression(copmiler construction)
Syntax directed translation
data Structure
Discrete mathematics presentation
Structure in C
Introduction to Data Structure & algorithm
Chapter 5
BCS302- Digital Design and computer organization -VTU-2022 scheme-Expectation...
Finaal application on regular expression
COMPILER DESIGN
Analytical learning
Logic programming (1)
Principles of programming languages. Detail notes
Ch.1 oop introduction, classes and objects
Asymptotic analysis
Inheritance in c++
Prolog Programming : Basics
fundamentals of c
Id3,c4.5 algorithim
Translation of expression(copmiler construction)
Ad

Similar to Lesson 1 of c programming algorithms and flowcharts.pptx (20)

PDF
LESSON__1-15 C-PROGRAMMING.p algorithm df
PPTX
PPTX
Algorithms and flow charts
PDF
Algorithmic problem sloving
PDF
Algorithm & Flowchart.pdf
PPTX
Algorithm and flowchart.pptx
PPT
Lecture 4
PPTX
Pseudo code.pptx
PPTX
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
PPTX
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
PDF
Planning the Computer program_e-content.pdf
PPTX
542996051-Program-Logic-Formulation.pptx
PPT
Unit 1 python (2021 r)
PPTX
Algorithms - Introduction to computer programming
PDF
Cse115 lecture03problemsolving
PPTX
Programming_Lecture_1.pptx
PPT
algorithm
PDF
final Unit 1-1.pdf
PPTX
FLOWCHARTS.pptx
PPT
C programming for Computing Techniques
LESSON__1-15 C-PROGRAMMING.p algorithm df
Algorithms and flow charts
Algorithmic problem sloving
Algorithm & Flowchart.pdf
Algorithm and flowchart.pptx
Lecture 4
Pseudo code.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
Planning the Computer program_e-content.pdf
542996051-Program-Logic-Formulation.pptx
Unit 1 python (2021 r)
Algorithms - Introduction to computer programming
Cse115 lecture03problemsolving
Programming_Lecture_1.pptx
algorithm
final Unit 1-1.pdf
FLOWCHARTS.pptx
C programming for Computing Techniques
Ad

Recently uploaded (20)

PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
web development for engineering and engineering
PPT
Mechanical Engineering MATERIALS Selection
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
OOP with Java - Java Introduction (Basics)
DOCX
573137875-Attendance-Management-System-original
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
PPT on Performance Review to get promotions
PDF
Digital Logic Computer Design lecture notes
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
composite construction of structures.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
Foundation to blockchain - A guide to Blockchain Tech
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Sustainable Sites - Green Building Construction
web development for engineering and engineering
Mechanical Engineering MATERIALS Selection
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
OOP with Java - Java Introduction (Basics)
573137875-Attendance-Management-System-original
Strings in CPP - Strings in C++ are sequences of characters used to store and...
CH1 Production IntroductoryConcepts.pptx
PPT on Performance Review to get promotions
Digital Logic Computer Design lecture notes
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
composite construction of structures.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx

Lesson 1 of c programming algorithms and flowcharts.pptx

  • 1. Programming For Problem Solving (PFPS) LECTURE 1 Introduction to Algorithms and Flowcharts
  • 2. Algorithms and Flowcharts • Algorithm and flowchart are the powerful tools for learning programming • An algorithm is a step-by-step analysis of the process, while a flowchart explains the steps of a program in a graphical way. • Algorithm and flowcharts helps to clarify all the steps for solving the problem. • For beginners, it is always recommended to first write algorithm and draw flowchart for solving a problem and then only write the program. 2
  • 3. Algorithms • A typical programming task can be divided into two phases: • Problem solving phase – Produce an ordered sequence of steps that describe solution of problem – This sequence of steps is called an algorithm – An algorithm is a sequence of steps to solve a particular problem – An algorithm is defined as an ordered set of unambiguous steps that produces a result and terminates in a finite time • Implementation phase – Implement the program in some programming language 3
  • 4. Steps In Problem Solving • First produce a general algorithm called pseudocode. • Pseudocode is an artificial and informal language that is very similar to everyday English. It helps programmers develop algorithms. • Refine the algorithm successively to get step by step detailed algorithm that is very close to a computer language. 4
  • 5. Characteristics of an Algorithm • Algorithm has the following characteristics – Input: An algorithm may or may not require input – Output: Each algorithm is expected to produce at least one result – Definiteness: Each instruction must be clear and unambiguous. – Finiteness: If the instructions of an algorithm are executed, the algorithm should terminate after finite number of steps 5
  • 6. Control Structures Involved In Algorithm and Flowchart • The algorithm and flowchart include following three types of control structures. – Sequence: In the sequence structure, statements are placed one after the other and the execution takes place starting from up to down. – Branching (Conditional): In branch control, there is a condition and according to a condition, a decision of either TRUE or FALSE is achieved. In the case of TRUE, one of the two branches is explored; but in the case of FALSE condition, the other alternative is taken. Generally, the ‘IF-THEN’ construct is used to represent branch control. – Loop (Repetition): The Loop or Repetition allows a statement(s) to be executed repeatedly based on certain loop condition using WHILE, Do-WHILE and FOR loops. 6
  • 7. Example of Pseudocode and Algorithm • Example 1: Write the pseudocode and detailed algorithm to determine a student’s final grade and indicate whether the student is passing or failing. The final grade is calculated as the average of four marks. • Pseudocode: – Input a set of 4 marks – Calculate their average by adding the marks and dividing the sum by 4 – if average is below 50 Print “FAIL” else Print “PASS 7
  • 8. Example of Pseudocode and Algorithm • Detailed Algorithm – Step 1: Input M1,M2,M3,M4 – Step 2: GRADE = (M1+M2+M3+M4)/4 – Step 3: if (GRADE < 50) then Print “FAIL” else Print “PASS” endif 8
  • 9. Advantages of Algorithm • It is a step-wise representation of a solution to a given problem, which makes it easy to understand. • An algorithm uses a definite procedure. • It is not dependent on any programming language, so it is easy to understand for anyone even without programming knowledge. • Every step in an algorithm has its own logical sequence so it is easy to debug. 9
  • 10. Flowchart • Flowchart is defined as a diagrammatic /graphical representation of sequence of steps to solve a problem. • By looking at a flowchart, any one can easily understand the operations and sequence of steps involved in the solution • Flowchart is often considered as a blueprint of a design used for solving a specific problem • Different symbols are used to draw each type of flowchart. 10
  • 11. Advantages of Flowchart • Flowchart is an excellent way of communicating the logic of a program. • It provides an easy and efficient way to analyze the solution to a problem. • During program development cycle, the flowchart plays the role of a blueprint, which makes the program development process easier. • After successful development of a program, it needs continuous timely maintenance during the course of its operation. The flowchart makes program or system maintenance easier. • It is easy to convert the flowchart into any programming language code. 11
  • 12. 12 Standard Symbols Used in a Flowchart
  • 14. Symbols Used in Algorithm and Flowchart • Assignment Symbol (← or =) is used to assign value to the variable. E.g., to assign value 5 to the variable HEIGHT, statement is HEIGHT ← 5 or HEIGHT = 5 • The symbol ‘=’ is used in most of the programming language as an assignment symbol, the same has been used in all the algorithms and flowcharts in the manual • The statement C = A + B means that add the value stored in variable A and variable B then assign/store the value in variable C 14
  • 15. 15
  • 16. 16
  • 17. 17 GO TO statement is also called unconditional transfer of control statement is used to transfer control of execution to another step/statement. E.g. the statement GOTO n will transfer control to step/statement n. Note: We can use keyword INPUT or READ or GET to accept input(s) /value(s) and keywords PRINT or WRITE or DISPLAY to output the result(s).
  • 20. Looping: Algorithm and Flowchart 20