It2EDU

Sunday, March 19, 2017

How to Write a program part - 2









A program is a solution of a specific program which is
unique for similar type problems. So a program is more helpful to find out the
solution of a problem. A program follow some syntax rules based on which
programming language is choose by the programmer.


Before going to solve a problem, a program has Algorithm and
Flow chart.


These two are helpful to find out the flow of program, input
information and approach of problem solving.





Use of a Flowchart:





A flowchart is used geometrical figure which represents the
flow of instructions of a program. We all know a program is set of
instructions.  How the instructions could
solve the problem what the data has to be taken by the user or programmer at
run time of a program. Also it shows how many variables are used to solve the
problem and what the operation is going to perform in the program everything
has presented in a clear way by using geometrical figures.


















The above diagram shows how the program is executed and what
variables are taken as input.


Also we need algorithm for the above program.


An algorithm is used to code the program in any programming
language.




  • Start

  • Accept variable of SUM, x and y.

  • Accept input for X and Y.

  • Perform operation SUM = X+Y

  • Print SUM

  • Stop.






After the algorithm is prepared start writing the code in
any programming language based on programmer interest it may be java, c, c++….
.net,python or any.


Every programming language has its own set of syntax and
rules, based on that rules programmer has to write the code. But here we need
to observe one thing that is irrespective of the programming language first
built the algorithm if the algorithm is good no doubt about you are the good
programmer.





You will find part-1 here.









0 comments:

Post a Comment