Skip to content

Instantly share code, notes, and snippets.

@janellbaxter
Created February 20, 2017 19:42
Show Gist options
  • Save janellbaxter/f9752fdd9b78daf6ab9231ae153033cb to your computer and use it in GitHub Desktop.
Save janellbaxter/f9752fdd9b78daf6ab9231ae153033cb to your computer and use it in GitHub Desktop.
9.1 For Loops; Programming is Fun: C# Adventure Game (Learn C#)
using System;
namespace Count
{
class Program
{
static void Main()
{
Console.Title = "Examples of for loops";
//increment
Console.WriteLine("Count 0 to 9!");
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
//decrement
Console.WriteLine("Count down 9 to 0!");
for (int j = 9; j > -1; j--)
{
Console.WriteLine(j);
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment