While loop to display 1 to 5

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy
Publisher: Sybex;
ISBN: 0782129110
*/
/*
Example4_8.cs illustrates the use of
a while loop to display 1 to 5
*/
public class Example4_8
{
public static void Main()
{
int counter = 1;
while (counter <= 5)
{
System.Console.WriteLine("counter = " + counter);
counter++;
}
}
}
Related examples in the same category