Friday, September 20, 2013

ALGORITHM AND FLOWCHART

ALGORITHM
 
It is step by step  procedure  to  solve  a  given problem .

After analyzing  the  problem ,programmer writes  the algorithm for  that  problem .

ADVANTAGES OF  ALGORITHM

1. It  is very  easy to understand .

2. IT  has  got  a  definate  procedure.

3. It is easy to  first  develop  an  algorithm  and  then convert  into  flowchart and  then  finally  into  program .

4. It  is  independent   of  programming  language .

5. It  is  easy  to  debug  as  every   step  has  got  its own  logical  sequence .

DISADVANTAGES  OF  ALGORITHM

It  is  time  consuming  and  cubersome ,because  first  algorithm   then  flowchart  and then into a  program.

EXAMPLE OF  ALGORITHM

Find  out  that  a given  number  is  even  or  odd.

STEP 1 : START

STEP 2  : INPUT  NUMBER

STEP 3  : rem = number mod 2

STEP 4 : if  rem=0 then

                  Print   " even number "

                  Else

                 Print    " odd number "

STEP 5 : STOP


FLOWCHART

A Graphical  representation  of   algorithm  is  known  as  flowchart .

Graphics  that  are used  while  accessing  a  flow chart .

Exmple of flowcart



No comments:

Post a Comment