Click the Twitter icon to follow our tweets and
know more about us.

Function to find sum of digits

 public int sum_of_digits(int n)
    {
        int k=0;
        while(n!=0)
        {
            k=k+(n%10);
            k/=10;
        }
        return(k);
    }

Comments (0)

Post a Comment