                        ²¢>> Continued from last page <<¹¼

   This is the same as total = total + count!  This is very useful.  Got that?
Here you can see the while loop demonstrated below:
²
/* whileloop.c */
main ()
{
    int count = 0;
    int total = 0;
    while ( count <10 )
    {
        total += count;
        printf ("count = %d\ttotal=%d\n", count++, total);
    }
}
¹
   What  this loop says here is:  "While the integer count is less than 10, do
everything  in  the  braces." So it will keep doing what's in the braces until
count  is  not  less  than 10.  In the braces it prints the value of count and
then  a tab (\t) and then total which is total + count and a new line.  So the
output of this program is:

count = 0   total=0
count = 1   total=1
count = 2   total=3
count = 3   total=6
count = 4   total=10
count = 5   total=15
count = 6   total=21
count = 7   total=28
count = 8   total=36
count = 9   total=45

   Finally the do-while loop.  The do while loop is very similar indeed to the
while loop, the big difference being that computer does whatever's in the loop
FIRST  and then checks that the condition is true.  Here is an example exactly
the same as the last program:
²
/* dowhile.c */
main()
{
    int total=0; 
    int count=0;
    do
    {
    total += count;
    printf ("count=%d\ttotal=%d\n", count++, total);
    }
    while (count < 10 );
 }
¹
   This  outputs  exactly  the  same  as the first one, I hope you can see the
difference between the two.

   Thankyou  for reading my tutorial, you should see another one next issue in
which  I'll  go  on  to  decisions  and functions.  I hope you've been able to
follow  it, if you haven't then you can give up any dreams of being a C-coder.
You  may  feel  that  we  haven't actually accomplished that much, and that is
true,  but you should now be getting the feel of the language, the syntax, and
how to compile.~