home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / DOWHILE.C < prev    next >
Text File  |  1989-11-10  |  412b  |  26 lines

  1.                                           /* Chapter 3 - Program 2 */
  2. /* This is an example of a do-while loop */
  3.  
  4. main()
  5. {
  6. int i;
  7.  
  8.    i = 0;
  9.    do {
  10.       printf("The value of i is now %d\n",i);
  11.       i = i + 1;
  12.    } while (i < 5);
  13. }
  14.  
  15.  
  16.  
  17. /* Result of execution
  18.  
  19. The value of i is now 0
  20. The value of i is now 1
  21. The value of i is now 2
  22. The value of i is now 3
  23. The value of i is now 4
  24.  
  25. */
  26.