The Five Steps - Step 4
Translate the algorithm into a programming language (like C)
We know that a
C program
is a collection of
functions.
For such a simple algorithm, we only need a single function.
Since every C program must have a function main(), we can implement
the algorithm by defining main().
Note: before even writing any code, we have included documentation
in our program file in the form of
comments
How do we define a function?
Defining a function in C consists of 2 parts - the
header,
and the
body:
to Overview.