Skip to content

Instantly share code, notes, and snippets.

@cowlike
Created March 6, 2018 20:34
Show Gist options
  • Save cowlike/6d18be652b9587d01b9aff804ea1f2ab to your computer and use it in GitHub Desktop.
Save cowlike/6d18be652b9587d01b9aff804ea1f2ab to your computer and use it in GitHub Desktop.
static bool isArmstrong(int n) {
var digits = n.ToString().Select(x => (int)(x - '0'));
return n == digits.Select(x => (int)Math.Pow(x, digits.Count())).Sum();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment