Last active
May 2, 2020 20:39
-
-
Save geektutor/85318db2fdc4b02128fd0924b6c180f2 to your computer and use it in GitHub Desktop.
Day 1 of 30DaysOfCode
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
import 'dart:math'; | |
void main(){ | |
print(armstrong(153)); | |
} | |
armstrong(number) { | |
var myList = number.toString().split(""); | |
var c = myList.length; | |
var a = 0; | |
for (var i = 0; i < c; i++) { | |
a += pow(int.parse(myList[i]), c); | |
} | |
return number == a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment