Algorithms and Flowchart
Algorithms & Flowchart
1
- In programming, algorithm are the set of well defined instruction in sequence to solve a program. An algorithm should always have a clear stopping point.
- An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem. The word derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to 850. Al-Khwarizmi's work is the likely source for the word algebra as well.
- A computer program can be viewed as an elaborate algorithm. In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem.
2
- A flowchart is a formalized graphic representation of a logic sequence, work or manufacturing process, organization chart, or similar formalized structure. The purpose of a flow chart is to provide people with a common language or reference point when dealing with a project or process.
- Flowcharts use simple geometric symbols and arrows to define relationships. In programming, for instance, the beginning or end of a program is represented by an oval. A process is represented by a rectangle, a decision is represented by a diamond and an I/O process is represented by a parallelogram. The Internet is represented by a cloud.
Algorithms
- A sequential solution of any program that written in human language,called algorithm.
- Algorithm is first step of the solution process, after the analysis of problem, programmer write the algorithm of that problem.
- 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:
Figure: Start/Stop terminal box |
Figure: Input/Output box |
Figure: Process/Instruction box |
Figure: Lines or Arrows |
Figure: Decision box |
Figure: Connector box |
Figure: Comment box |
Figure: Preparation box |
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.
Figure: Flowchart example of C program |
No comments:
Post a Comment