public static int sumDigits(int number){
if (number < 10) return -1;
int sum = 0;
while (number > 10){
sum += number % 10;
number /= 10;
}
return sum + number;
public static void main(String[] args) {
int num = 321;
int sum = 0;
while (num > 0) {
sum = sum + num % 10;
num = num / 10;
}
System.out.println(sum);
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num = input.nextInt();
int sum = 0;
while (num > 0) {
sum += num % 10;
num /= 10;
}
System.out.println("sum of digits: " + sum);
}