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:
Example 1:
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.
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:
- The algorithm must terminate after the finite steps.
- Each step must be clear.
- Each step must be effective.
- There can be zero or more inputs.
- 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.
---------------------------------------------------------------------------------
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.
thanks .......
ReplyDelete