Flowcharts and algorithms
Prepared by:
Ravi Bharadva 130110120007
Hemdeep Bhavsar 130110120008
Nayan Chauhan 130110120009
Chintan Kathrecha 130110120010
Chitt Kakadia 130110120011
Yashraj Chudasama 130110120012
Faculty
J.V SIR
WHAT IS ALGORITHM?
Algorithm
 An algorithm is the finite set of sequential
instructions to accomplish a task where instructions
are written in a simple English language.
 It is called as a step by step solution of the program.
 It is a well developed, organized approach to solving
complex problems.
 It refers to logic of program.
 It is step by step solution to given program.
Characteristics of algorithm
 Algorithm has four characteristics:
 Finiteness : Total number of steps used in algorithm
should be finite.
 Definiteness : Each step of algorithm must be clear
and un ambiguous.
 Effectiveness : Every step must be basic and
essential.
 Input & output: the algorithm must accept zero or
more input and must produce at least one output.
How to develop an algorithm
 First identify different inputs to be given to system.
 Then identify what output you want from the
program.
 Then create logic for it.
 Break that logic into simple steps.
 Write this steps in order.
 This forms the algorithm required from the given
logic.
Advantages Disadvantages
 Very easy to write.
 Easy technique to
understand logic.
 Easy identification of
the mistakes by non
computer person.
 Time consuming.
 Difficult to show
branching and looping.
 Big tasks are difficult to
put in algorithm.
Write an algorithm to calculate area of
rectangle.
 Step 1: accept value of length i.e l
 Step 2: Accept the value of breadth i.e b
 Step 3: calculate area. i.e a=l*b
 Step 4: print area i.e Print a.
 Step 5: stop
Create a program to get name and roll
number from user and print it!
 Step 1: Initialize name as character and roll number
as integer
 Step2: Display message “ENTER NAME:” on screen
 Step 3: Get name from user
 STEP 4: Display message “ENTER R.NO:”
 Step 5: Get Roll number from USER
 STEP 6: clear the screen
 STEP 7: Print name on screen
 STEP 8: Print roll number on screen
 STEP 9: STOP
Write an algorithm to
determine a student’s final grade and
indicate whether it is passing or failing.
The final grade is calculated as the
average of four marks.
 Step 1: input a set of 4 marks
 Step 2: calculate average of marks
 Step 3: if avg <50 then go to next step else go to step
5.
 Step 4: print fail.
 Step 5: print pass.
 Step 6: stop
Write a algorithm to find out smallest
number out of two numbers.
 Step 1: Accept Two number I.e a,b
 Step 2: check if a<b? if yes go to step 3 else go to
step 5.
 Step 3: Print a is smallest number.
 Step 4: stop
 Step 5: print b is smallest number.
 Step 6 : stop
WHAT IS FLOWCHART?
What is a flowchart?
 It is a pictorial representation of the algorithm.
 What we did in algorithm, we can represent it in
flowchart.
 This format is easy to understand.
 It shows us the flow of the instructions.
Symbols of flowchart
Name Symbol Use in flowchart
Oval Used at starting and at
ending of the program.
Flowlines Used to show direction
of the flow.
Parallelogram Used for input output
options.
Rectangle Denotes process to be
carried out.
Symbols of flowchart
round
Diamond It is used for showing
decision structure.
Round Connecting flow lines
from different places
Block Indicates block of
statements or body of
loop
Advantages Disadvantages
 Easy to draw.
 Easy technique to
understand logic.
 Easy to identify the
mistake by non
computer person.
 Easy for branching and
looping.
 Time consuming.
 Difficult for modification.
 Difficult task to draw
flow charts for big
programs.
Different operators used in programing
 Determine how one value relates to another
 Equal to ==
 Not equal to !=
 Less than <
 Greater than >
 Less than or Equal to <=
 Greater than or Equal to >=
Example : write an algorithm and flowchart for
converting length in feet to centimeter.
 Algorithm:
 Step1: input l in ft
 Step 2: L in cm= l in ft*30
 Step 3: Print l in cm.
 Flowchart:
in ft
start
Read
value of l
L in cm= l in ft*30
Print l in cm
stop
Example: write an algorithm and flowchart to
read 2 sides of rectangle and calc. its area.
 Algorithm:
 Step1: read input W,L.
 Step2: A=W*L
 Step3: print A
 Flowchart:
 Read W,L
start
Read
value of W
& L
A= L*W;A = L * W
Print area
A
stop
Any questions?
flowchart & algorithms

flowchart & algorithms

  • 1.
    Flowcharts and algorithms Preparedby: Ravi Bharadva 130110120007 Hemdeep Bhavsar 130110120008 Nayan Chauhan 130110120009 Chintan Kathrecha 130110120010 Chitt Kakadia 130110120011 Yashraj Chudasama 130110120012 Faculty J.V SIR
  • 2.
  • 3.
    Algorithm  An algorithmis the finite set of sequential instructions to accomplish a task where instructions are written in a simple English language.  It is called as a step by step solution of the program.  It is a well developed, organized approach to solving complex problems.  It refers to logic of program.  It is step by step solution to given program.
  • 4.
    Characteristics of algorithm Algorithm has four characteristics:  Finiteness : Total number of steps used in algorithm should be finite.  Definiteness : Each step of algorithm must be clear and un ambiguous.  Effectiveness : Every step must be basic and essential.  Input & output: the algorithm must accept zero or more input and must produce at least one output.
  • 5.
    How to developan algorithm  First identify different inputs to be given to system.  Then identify what output you want from the program.  Then create logic for it.  Break that logic into simple steps.  Write this steps in order.  This forms the algorithm required from the given logic.
  • 6.
    Advantages Disadvantages  Veryeasy to write.  Easy technique to understand logic.  Easy identification of the mistakes by non computer person.  Time consuming.  Difficult to show branching and looping.  Big tasks are difficult to put in algorithm.
  • 7.
    Write an algorithmto calculate area of rectangle.  Step 1: accept value of length i.e l  Step 2: Accept the value of breadth i.e b  Step 3: calculate area. i.e a=l*b  Step 4: print area i.e Print a.  Step 5: stop
  • 8.
    Create a programto get name and roll number from user and print it!  Step 1: Initialize name as character and roll number as integer  Step2: Display message “ENTER NAME:” on screen  Step 3: Get name from user  STEP 4: Display message “ENTER R.NO:”  Step 5: Get Roll number from USER  STEP 6: clear the screen  STEP 7: Print name on screen  STEP 8: Print roll number on screen  STEP 9: STOP
  • 9.
    Write an algorithmto determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.  Step 1: input a set of 4 marks  Step 2: calculate average of marks  Step 3: if avg <50 then go to next step else go to step 5.  Step 4: print fail.  Step 5: print pass.  Step 6: stop
  • 10.
    Write a algorithmto find out smallest number out of two numbers.  Step 1: Accept Two number I.e a,b  Step 2: check if a<b? if yes go to step 3 else go to step 5.  Step 3: Print a is smallest number.  Step 4: stop  Step 5: print b is smallest number.  Step 6 : stop
  • 11.
  • 12.
    What is aflowchart?  It is a pictorial representation of the algorithm.  What we did in algorithm, we can represent it in flowchart.  This format is easy to understand.  It shows us the flow of the instructions.
  • 13.
    Symbols of flowchart NameSymbol Use in flowchart Oval Used at starting and at ending of the program. Flowlines Used to show direction of the flow. Parallelogram Used for input output options. Rectangle Denotes process to be carried out.
  • 14.
    Symbols of flowchart round DiamondIt is used for showing decision structure. Round Connecting flow lines from different places Block Indicates block of statements or body of loop
  • 15.
    Advantages Disadvantages  Easyto draw.  Easy technique to understand logic.  Easy to identify the mistake by non computer person.  Easy for branching and looping.  Time consuming.  Difficult for modification.  Difficult task to draw flow charts for big programs.
  • 16.
    Different operators usedin programing  Determine how one value relates to another  Equal to ==  Not equal to !=  Less than <  Greater than >  Less than or Equal to <=  Greater than or Equal to >=
  • 28.
    Example : writean algorithm and flowchart for converting length in feet to centimeter.  Algorithm:  Step1: input l in ft  Step 2: L in cm= l in ft*30  Step 3: Print l in cm.  Flowchart: in ft start Read value of l L in cm= l in ft*30 Print l in cm stop
  • 29.
    Example: write analgorithm and flowchart to read 2 sides of rectangle and calc. its area.  Algorithm:  Step1: read input W,L.  Step2: A=W*L  Step3: print A  Flowchart:  Read W,L start Read value of W & L A= L*W;A = L * W Print area A stop
  • 30.