You can say algorithm is a logical map of your program. Now consider you are given a problem and you have to create a program to solve it. Lets take an example.
ex. Create a program to determine whether input number is even or odd.
Now if you directly start writing the program code, you will find it very difficult to complete the program. But if you create steps and procedure map (algorithm) on the paper, you will find it very easy to write the program. Here is the algorithm for above problem. Meaning of each step is also given in bracket for better understanding.
- start (include header files or other resources which your program may need)
- input number A (write the coding part which takes number input from keyboard)
- perform operation B = 'A % 2' (perform modulo operation by 2 to check whether input no. Is perfectly divisible by 2)
- if B=0
- display "input number is even"
- Goto step 6
- display "input number is odd"
- goto step 6
- End (terminate the program)
As above example is one of the simplest examples, it is not much difficult to write the program directly. But if the problem is bigger and requires large number of logic steps and loops it is always advised to create the algorithm first because it makes you simpler to write the program.
For detailed information get help at CodeAvail- Online Computer Science Assignment