BrainDump
  Home arrow BrainDump arrow Page 2 - C:Loops
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

C:Loops
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 29
    2008-03-17

    Table of Contents:
  • C:Loops
  • While You Were Away
  • Do it While You Can
  • The Break And Continue Statement

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C:Loops - While You Were Away


    (Page 2 of 4 )

    While loops work by saying: while this is true, keep repeating through the loop. Let's look at a program to print some text:


    #include <stdio.h>

    int main()

    {

    int count;

    count= 0;

    while (count<10)

    {

    printf("Look a loop!n");

    count++;

    }

    return(0);

    }

    This program will print the following:

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

      Look a loop!

    Let's try something else. Change the value of count to 11 and run the program again.

    Nothing happens, right? This is because the loop only executes while the criteria is true.

    Otherwise it won't execute at all.

    To fix this, if it indeed needs fixing, we can create a Do While loop.

    More BrainDump Articles
    More By James Payne


       · Hey, welcome to my article on C Loops. where we discuss the different types of loops...
       · Thankyou for the information its in very simple and understandable...
     

    BRAINDUMP ARTICLES

    - Are Microsoft Certifications Worth the Cost ...
    - Microsoft, NSF Open Cloud Computing to Scien...
    - Windows 7 Grabs One-Tenth of Market
    - Windows Mobile 7
    - Commands in WPF
    - Routing Events in WPF
    - Property Value Inheritance and More WPF Conc...
    - Important New Concepts in WPF
    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek