Skip to content

Instantly share code, notes, and snippets.

@guaracy
Created February 6, 2016 03:40
Show Gist options
  • Save guaracy/1cc8824a8fb1e2bf9287 to your computer and use it in GitHub Desktop.
Save guaracy/1cc8824a8fb1e2bf9287 to your computer and use it in GitHub Desktop.
using System;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
p.sing();
}
public void sing()
{
int bottles;
int max = 99;
string bottleWord = "";
for (bottles = max; bottles > 0; --bottles)
{
if (bottles == 1)
{
bottleWord = "Bottle";
}
else
{
bottleWord = "Bottles";
}
if (bottles != 99)
{
Console.WriteLine("Take one down and pass it around");
Console.WriteLine(bottles + " " + bottleWord + " of beer on the wall.");
Console.WriteLine();
}
Console.WriteLine(bottles + " " + bottleWord + " of beer on the wall");
Console.WriteLine(bottles + " " + bottleWord + " of beer");
}
Console.WriteLine("Take one down and pass it around");
Console.WriteLine("No more bottles of beer on the wall.");
Console.WriteLine("");
Console.WriteLine("Go to the store and buy some more");
Console.WriteLine(max + " bottles of beer on the wall.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment