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.
Write a algorithm to find out number is odd or even?
Algorithm is a stepwise solution to any problem which is used in programming to create a knowledge of steps to write a program.
- 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.
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
Post a Comment