///////
//
// Student: Russell Lowke
//     T.F: Francis Crick
// Unit Three, pencil-and-paper - question 4 [worth 2pts],  7/6/2002
//
//  Design an algorithm to sum up the digits in any integer (positive, negative or zero)
//  i.e   456 = 15
//



    int mInt, r, sum = 0;

    cin >> mInt;			// read number
    
    mInt = abs(mInt);       // convert to absolute value
	
	do {
		r    = mInt % 10;   // find units
		sum  = sum + r;     // add units to sum
		mInt = mInt / 10;   // divide by 10
							// (integer type will loose decimal point)
		
	} while (mInt > 0);		// loop while positive
	
	cout << sum << endl;    // print