Created
May 3, 2020 03:15
-
-
Save geektutor/49b0f943c29789c68e0319e1f35e3cb2 to your computer and use it in GitHub Desktop.
Day 1 Solution of 30 Days Of Code
This file contains hidden or 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
import 'dart:math'; | |
void main(){ | |
print(armstrong(54748)); | |
} | |
armstrong(number) { | |
var myList = number.toString().split(""); | |
var c = myList.iterator; | |
var a = 0; | |
while (c.moveNext()) { | |
a += pow(int.parse(c.current), myList.length); | |
} | |
return number == a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment