Programming/Algorithm
[Java - 알고리즘] 입력된 정수의 합 구하기
package com.tistory.johnmarc; import java.util.Scanner; public class InputIntegerSum { public static void main(String[] args) { System.out.print("Input: "); Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); System.out.println("SUM: " + sumInputInteger(x)); } private static int sumInputInteger(int value) { int sum = 0; while (value != 0) { sum += value % 10; value /= 10; } retu..