C Part-1


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

Flowchart for finding Armstrong number C program:

Flowchart for check, a number is Armstrong or not C program
Figure: Flowchart for finding number is 
Armstrong or not C program

ADVANTAGES OF USING FLOWCHARTS :The benefits of flowcharts are as follows:1.  Communication: Flowcharts are better way of communicating the logic of a system to all concerned.
2.  Effective analysis: With the help of flowchart, problem can be analysed in more effective way.
3.  Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes.
4.  Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase.
5.  Proper Debugging:  The flowchart helps in debugging process.
6.  Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part

LIMITATIONS OF USING FLOWCHARTS :1.  Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.
2. Alterations and Modifications: If alterations are required the flowchart may require re-drawing completely.
3. Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.   
4.  The essentials of what is done can easily be lost in the technical details of how it is done.

BENEFITS OF USING ALGORITHMS :
=>  The use of algorithms provides a number of benefits.
=> One of these benefits is in the  development of the procedureitself, which involves identification of the processes, major decision points, and variables necessary to solve the problem.
=> Developing an algorithm allows and even forces examination of the solution  process in a rational manner.
=> Identification of the processes and decision points reduces the task into a series of smaller steps of more manageable size.
=> Problems that would be difficult or impossible to solve in entirety can be approached as a series of small, solvable sub-problems.

No comments:

Post a Comment