public class Digit_Sum
{
public static void main(String[] args)
{
int n = 1230;
int result = digit_sum(n);
System.out.println("Sum:"+result);
}
public static int digit_sum(int n)
{
int sum = n % 10;
if(n == 0)
{
return 0;
}
else
{
return sum + digit_sum(n / 10);
}
}
}