So this is my code so far.
public int getsum (int n){
int num = 23456;
int total = 0;
while (num != 0) {
total += num
import java.util.Scanner;
public class Adder {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter a number: ");
System.out.println();
int number = input.nextInt();
System.out.println("The sum of the digits is " +adder(number));
}
public static int adder(int num){
int length = String.valueOf(num).length();
int first , last , sum;
if (length==1){
return num;
}
else
{
first = num /10;
last = num % 10;
sum = last + adder(first);
}
return sum;
}
}