#include <stdio.h>

/* program illustrating the use of for, while, and do..while loops 
   to print the numbers 1 to 10
 */

int
main (void)
{
  printf ("program to print 1..10 with three loop constructs\n");

  int start = 1;
  int end = 10;
  int i;

  /* for loop */
  printf ("for loop\n");
  for (i = start; i <= end; i++)
    {
      printf ("%5d", i);
    }
  printf ("\n");

  /* while loop */
  printf ("while loop\n");
  i = start;
  while (i <= end)
    {
      printf ("%5d", i);
      i++;
    }
  printf ("\n");

  /* do while */
  printf ("do..while loop\n");
  i = start;
  do
    {
      printf ("%5d", i);
      i++;
    }
  while (i <= end);
  printf ("\n");

  return 0;
} // main
