Checking whether or not a number is an Armstrong Number

By Cooldudue | My Coding adventure | 5 May 2022


This was an interesting challenge as I had no idea how I was going to get each digit into an array. In python, you can just convert the int to a string and then index the string directly. I found this interesting solution on Stack Exchange to convert the int to an array of char.  From there all that is required is to check whether or not the sum of the cube of all the digits is equal to the original number. I am quite happy with this solution although I do regret that I wasn't able to do it by myself.

Check my GitHub to see the code.

How do you rate this article?

8



My Coding adventure
My Coding adventure

Hello, I am a recent graduate from the University of Cape Town. I have a Bachelor of Science in Mathematics and Applied Mathematics. I am interested in becoming a developer. If you are interested in hiring please check out my CV and we can get in contact. I will be posting any projects I am working on here. My Java is a little rusty so I will be working on small problems to familiarise myself again. My CV: https://docs.google.com/document/d/1qVs7YYqWrkn70xxv6EdDgAH3k7LVA2unwC8tLzQCS4M/edit?usp=sharing

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.