Skip to content

Instantly share code, notes, and snippets.

Created April 30, 2010 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/384987 to your computer and use it in GitHub Desktop.
Save anonymous/384987 to your computer and use it in GitHub Desktop.
public static string GetNoun(long number, String one, String two, String five)
{
number = Math.Abs(number);
number %= 100;
if (number >= 5 && number <= 20)
{
return five;
}
number %= 10;
if (number == 1)
{
return one;
}
if (number >= 2 && number <= 4)
{
return two;
}
return five;
}
public static string GetAdj(long number, String one, String two)
{
number = Math.Abs(number);
number %= 100;
if (number == 11) return two;
number %= 10;
if (number == 1) return one;
return two;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment