Sunday, 12 August 2012

Algorithm and Flowchart


Algorithm and Flowchart 

What is Algorithm?
      The simple step by step non-formatted  statements to solve the specific problem .

Characteristics for good Algorithm: 
   The set of well-defined clear statements
   An algorithm should have zero or more input. 
   An algorithm should exhibit at least one output. 
   An algorithm should be finite.
   Each instruction used in an algorithm should be basic and easy to perform.
   An algorithm can be represented diagrammatically in the form of a flow chart.

Template of Algorithm

Step 1 - START
It represents beginning of the algorithm.
Step 2 - DECLARE
The variables used in algorithm are declared.
Step 3 - INPUT
Input the values
Step 4 - Assignment or Process or Looping or Mathematical Expressions 
The required result is generated.
Step 5 - OUTPUT
It displays the output or result.
Step 6 - STOP
It is an end of Algorithm    


Example for Algorithm

Problem : 
             Convert any Decimal number to Binary format


Step 1 : Start the process
Step 2 : Declare the x as integer Number.
Step 3 : Get the decimal number as x.
Step 4 : Divide x by 2; Assign quotient as x and Keep the remainder.
Step 5 : Repeat step 4 on the quotient x; 
              Repeat step 4 until the quotient x becomes one.
Step 6 : Write all remainder digits in the reverse order (last remainder first – left Most digit) to form the final result.
Step 7 : Display the result 
Step 8 : Stop the Process

Flowchart 


Flowchart 

The Pictorial representation of Algorithm is called as Flowchart. 
A graphical representation of a process (e.g. an algorithm), in which graphic objects are used to indicate the steps & decisions that are taken as the process moves along from start to finish.

The Symbols of Flowchart


Example for Flowchart :
Problem :   Convert temperature from Fahrenheit to Celsius






No comments:

Post a Comment