Create a function to check if a number is an Armstrong number.
HardProblem Statement
Create a function to check if a number is an Armstrong number.
Sample Input
A hardcoded number, e.g., 153.
Sample Output
153 is an Armstrong number
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
fun isArmstrongNumber(num: Int): Boolean {
// Add your code here to check if the number is Armstrong
}
fun main() {
val num = 153
if (isArmstrongNumber(num)) {
println("$num is an Armstrong number")
} else {
println("$num is not an Armstrong number")
}
}
Input
A hardcoded number, e.g., 153.
Expected Output
153 is an Armstrong number