import java.util.Scanner;

class Assignment6E
{
	public static void main (String[] args)
	{
		 int total=0;
         int number;
         int originalNumber;
         
         int choice;
         int digit;
         
         Scanner input = new Scanner (System.in);
         System.out.println("This program will add the digits of a number ");
         do
			{
        	 total=0;
				 System.out.println("Please type in a number ");
		        number=input.nextInt();
		        originalNumber=number;
		         
		              
						do  //get the digits
						{
							digit=number%10;
							number=number/10;
							total=total+digit;
							
						}while(number>0);
						
						System.out.printf("The sum of the digits of %d is %d ",originalNumber,total );
		       
				System.out.println("Would you like to continue ? (0-no/1-yes) ");
		         choice = input.nextInt();
			}while (choice != 0);
		          
	  
			}
} 