Algorithm

Algorithm:

     Algorithm refers the logic of a program and a step-by-step description of how to arrive at the solution of a given problem.

Features of Algorithm:


  1. The algorithm must terminate after the finite steps.
  2. Each step must be clear.
  3. Each step must be effective.
  4. There can be zero or more inputs.
  5. There should be at least one output.
---------------------------------------------------------------------------------
Example 1:


Write an Algorithm to read and print  the single value.

Answer:

Step 1: Start.
Step 2: Input any value. 
Step 3: Print the value.
Step 4: Stop.
---------------------------------------------------------------------------------
Example 2:

Write an Algorithm to calculate sum of two numbers.

Answer:

Step 1: Start.
Step 2: Read value of number1. 
Step 3: Read value of number2.
Step 4: calculate total=num1+num2.
Step 5: Print total.
Step 6: Stop.



   << PREVIOUS                                                                                     NEXT>>

1 comment: