for Example:
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26
but i does not get desired results
when i add all char it gives output as: 266
import java.util.Scanner;
public class ProjectEu {
public static void main(String...rDX) {
int degree = new Scanner(System.in).nextInt();
String store = Integer.toString((int)Math.pow(2,degree));
char [] finals = store.toCharArray();
int temp = 0;
for (int i = 0, n = store.length(); i < n; i++) {
System.out.printf("values[%d] --> %c \n",i, finals[i]);
temp = temp + finals[i];
}
System.out.println(temp);
}
}