Algorithms

Definition: -

Algorithm is a stepwise solution to any problem which is used in programming to create a knowledge of steps to write a program.

  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.
As Algorithm goes in sequence it is written in steps for example: -

Write a algorithm to find out number is odd or even?
Ans. 

step 1 : start
This Represents Starting of Algorithm.
step 2 : input number
This is for input which is inserted by user or given in program by default.
step 3 : rem=number mod 2
rem is defined as variable which is storing the Result of number mod 2
step 4 : if rem=0 then
               print "number even"
           else
               print "number odd"
           endif
This step contains the whole solution to find the number is odd or even
step 5 : stop                                                       
This step indicates that algorithm is finished or stopped.

Comments

Popular posts from this blog

Constants

Data Types in C Programming

Identifiers