c# how to while loop code example Example: c# while int n = 0; while (n < 5) { Console.WriteLine(n); n++; }