Power digit sum
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
What is the sum of the digits of the number 21000?
Again a very simple and direct problem, if you were to solve it using python. I am not going to explain any algorithm because, in this program we have just used inbuilt python functions and have got the result.
Program
The program is as follows:All the code is well commented and I am assuming that you can understand it.
If you want to download this program you can download it from Github Gist.
Output
Summary
This problem was pretty easy to solve. This problem just involved brushing up of our concepts in the python programming language.The code is well commented and so I have not explained any snippet of the code. But if you have any doubt or didn't understand anything then please do comment in the comment box below and I will be glad to help you.
Please do comment if I have made any typo or if you have a better/different solution other than the one stated above. Feel free to ask me anything related.
You can also contact me if you want to.
Thank you. Have a nice day😃.