Algorithm: An Algorithm Must Possess The Following Characteristics
Algorithm: An Algorithm Must Possess The Following Characteristics
Algorithm
In computer science, algorithm is a step by step procedure for
writing programs. It is defined as a sequence of instructions
designed in such a way that if the instructions are executed in
the specified sequence, the desired result will be obtained.
Examples:
1) Write an algorithm to add two numbers
Algorithm
Step 1 : Read two numbers (a,b)
Step 2 : Add the two numbers (result = a+b)
Step 3 : Print the result
2) Write an algorithm to find the average of four numbers
Algorithm
Step 1 : Read four numbers (a,b,c,d)
Step 2 : Add the four numbers (sum = a+b+c+d)
Step 3 : Divide the result of addition by 4 (result = sum/4)
Step 4 : Print the result
Diploma in Electrical Engineering II/I
Manmohan Memorial Polytechnic
1 of 1