JeffGrigg

HomeworkMath

May 28th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.41 KB | None | 0 0
  1. public class HomeworkMath {
  2.  
  3.     public static int sumOfSumsOfDigitsInCyclicOrder(final int inputNumber) {
  4.         int remainingDigits = inputNumber, summedDigits = 0, sumOfSumsResult = 0;
  5.         while (remainingDigits > 0) {
  6.             summedDigits += remainingDigits % 10;
  7.             sumOfSumsResult += summedDigits;
  8.             remainingDigits /= 10;
  9.         }
  10.         return sumOfSumsResult;
  11.     }
  12.  
  13. }
Add Comment
Please, Sign In to add comment