Professional Documents
Culture Documents
Step 2: Designing the algorithm Now let’s design the algorithm with the
help of above pre-requisites:
START
Declare 3 integer variables num1, num2 and num3.
Take the three numbers, to be added, as inputs in variables num1, num2, and
num3 respectively.
Declare an integer variable sum to store the resultant sum of the 3 numbers.
Add the 3 numbers and store the result in the variable sum.
Print the value of variable sum
END
START
Step 1: Fill the 5-liter jar.
Step 2: Empty 3 liters out of it into the 3-liter jar.
Step 3: Discard the contents of 3-liter jar.
Step 4: Empty the 2 liters in the 5-liter jar into the 3-liter jar.
Step 5: Fill the 5-liter jar again.
Step 6: Empty a liter from the 5-liter jar into the partially filled 3-liter jar (which
has 2 liters in it).
Step 7: Discard the contents of the 3-liter jar.
Step 8: The 5 liter jar has 4 liters left out in it.
END
Annotation/Comment: Indicating additional
information about a step in the program.