Project Euler | Problem 16 | Power digit sum
Problem Description:
2^15= 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
Concept:
Java Program:
Output:
Figure2 |
Similar Problems:
References:
https://projecteuler.net/problem=16
https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
Thank you friends, I hope you have clearly understood the solution of this problem. If you have any doubt, suggestion or query please feel free to comment below. You can also discuss this solution in our forum.
https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
Thank you friends, I hope you have clearly understood the solution of this problem. If you have any doubt, suggestion or query please feel free to comment below. You can also discuss this solution in our forum.
Project Euler | Problem 16 | Power digit sum
Reviewed by Rohit Agarwal
on
10/15/2017
Rating:
why did you use -48
ReplyDeleteBecause ascii value of 0-9 digit is 48-57 and on subtracting two ascii values, we will get integer.
ReplyDelete