Computer >> Computer tutorials >  >> Programming >> C programming

What is an algorithm and flowchart in C language?


Algorithm is a step – by – step procedure which is helpful in solving a problem. If, it is written in English like sentences then, it is called as ‘PSEUDO CODE’.

Properties of an Algorithm

An algorithm must possess the following five properties −

  • Input
  • Output
  • Finiteness
  • Definiteness
  • Effectiveness

Example

Algorithm for finding the average of three numbers is as follows −

  • Start
  • Read 3 numbers a,b,c
  • Compute sum = a+b+c
  • Compute average = sum/3
  • Print average value
  • Stop

FLOW CHART

Diagrammatic representation of an algorithm is called flow chart.

Symbols used in flowchart are mentioned below −

NameSymbolPurpose
TerminalWhat is an algorithm and flowchart in C language?Ovalstart/stop/begin/end
Input/output
What is an algorithm and flowchart in C language?
Parallelogram
Input/output of data
ProcessWhat is an algorithm and flowchart in C language?RectangleAny processing to be performaed can be represented
Decision boxWhat is an algorithm and flowchart in C language?DiamonDecision operation that determine which of the alternative paths to be followed
ConnectorWhat is an algorithm and flowchart in C language?CircleUsed to connect different parts of flowchart
FlowWhat is an algorithm and flowchart in C language?ArrowsJoin 2 symbols and also represents flow of execution
Pre defined processWhat is an algorithm and flowchart in C language?Double Sided RectangleModule (or) subroutines specified else where
Page connectorWhat is an algorithm and flowchart in C language?PentagonUsed to connect flowchart in 2 different pages
For loop symbolWhat is an algorithm and flowchart in C language?Hexagonshows initialization, condition and incrementation of loop variable
DocumentWhat is an algorithm and flowchart in C language?PrintoutShows the data that is ready for printout

Example

Given below is the flowchart for finding an average of three numbers −

What is an algorithm and flowchart in C language?