WHAT'S NEW?
Showing posts with label digit. Show all posts
Showing posts with label digit. Show all posts
public class SumOfDigits 
{   
    public static void main(String[] args)   
    {   
        int i = 234;   
int sum = 0;   
int remainder;
        
    
        System.out.println("Number Entered: " + i);   

        while ( i > 0 )  
        {  
        remainder= i%10;   
sum=sum+remainder;
         i=i/10;   
         }
         
            System.out.println("digits after calculation: " +sum);  
        }   
    }