# Algorithm has 3 sections :

Header : Algorithm Name.
Declaration : A description of variable and their types.
Algorithm body's : A Sequenc of algorithm steps.
----------------
----------------
----------------
Halt

# Example 1 : Algorithm for adding two numbers

1. Start
2. [ Obtain input values ]
Read (A, B)
3. [ Add numbers and store the result ]
C <- A + B
4. [ Print result ]
Write (c)
5. Stop

# Example 2 : Algorithm for finding xn for given x and n

1. Start
2. [ Obtain input value ]
Read (x, n)
3. [ initialize result so far ]
result -> x
4. [ initialize loop counter ]
i -> 1
5. [ Print result ]
repeat thru step 7 while i < n
6. [ Recomputed result so far ]
result <- result * x
7. ( increment counter )
i <- i + 1
8. ( Display result )
Write (x, n, result)
9. ( finish )
10. Halt

# What are the Notations we will use to write an Algorithm?

Notations :
Beginning or Ending : Start, Stop
Input :Read( variable )
Example : Read( var1, var2 )
Output : Write ("Test to be displayed", variables)
Example : Write("Learning C", var1, var2)
Comment : [ Information ]
Operator :
&&, >, <, +, -, *, /, %, and, or, not
Reactions