Use a while loop to display 1 to 5
class MainClass
{
public static void Main()
{
int counter = 1;
while (counter <= 5)
{
System.Console.WriteLine("counter = " + counter);
counter++;
}
}
}
Output counter = 1
counter = 2
counter = 3
counter = 4
counter = 5
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
|