Purpose of Program Planning

Posted on at


Purpose of Program Planning


O To write a correct program, a programmer must write each and every instruction in the correct sequence. O Logic (instruction sequence) of a program can be very complex. O Hence, programs must be planned before they are written to ensure program instructions are: O Appropriate for the problem O In the correct sequence
Algorithm
O Refers to the logic of a program and a step-by-step description of how to arrive at the solution of a given problem. O In order to qualify as an algorithm, a sequence of instructions must have following characteristics:  Each and every instruction should be precise and clear.  Each instruction should be such that it can be performed in a finite time.  One or more instructions should not be repeated infinitely.  This ensures that the algorithm will ultimately terminate.  After performing the instructions, that is after the algorithm terminates, the desired results must be obtained.
Algorithm Example 1
O Write a algorithm to find out number is odd or even? O Solution: • step 1 : start • step 2 : Take a number from the user as an input • step 3 : Take remainder after dividing the number by 2. • step 4 : If remainder is 0 then print "number even“ else print "number odd“. • step 5 : stop



About the author

160