Saturday, September 3, 2011

Algorithms and Flowchart

Algorithms
  1. A sequential solution of any program that written in human language,called algorithm.
  2. Algorithm is first step of the solution process, after the analysis of problem, programmer write the algorithm of that problem.
  3. Example of Algorithms:
Q. Write a algorithem to find out number is odd or even?
Ans. 
step 1 : start
step 2 : input number
step 3 : rem=number mod 2
step 4 : if rem=0 then
               print "number even"
           else
               print "number odd"
           endif
step 5 : stop


Flowchart

1. Graphical representation of any program is called flowchart.
2. There are some standard graphics that are used in flowchart as following:

Start / Stop terminal box flowchart symbol
Figure: Start/Stop terminal box

Input/output flowchart symbol
Figure: Input/Output box

Process / Instructions box flowchart symbol
Figure: Process/Instruction box

Lines or Arrows to show the flow of flowchart
Figure: Lines or Arrows

Decision box flowchart symbol
Figure: Decision box

Connector box flowchart symbol
Figure: Connector box

Comment/Expression flowchart symbol
Figure: Comment box

Preparation flowchart symbol
Figure: Preparation box

Separate flowchart symbol
Figure: Separate box

Q. Make a flowchart to input temperature, if temperature is less than 32 then print "below freezing" otherwise print  "above freezing"?
Ans.
Flowchart Example of C progarm
Figure: Flowchart example of C program


Related programs:

  1. Flowchart for search prime number
  2. Factorial C program, Algorithm and Flowchart
  3. Flowchart for finding Armstrong number
  4. Rules for constructing an Algorithm
  5. if, if...else, nested if...else, if...else if - statement and flowchart

No comments:

Post a Comment