Created
March 6, 2018 20:34
-
-
Save cowlike/6d18be652b9587d01b9aff804ea1f2ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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