Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

add digits java


public static void main(String[] args) {
        int num = 321;
        int sum = 0;
        while (num > 0) {
            sum = sum + num % 10;
            num = num / 10;
        }
        System.out.println(sum); 
}

Source by devarama.com #
 
PREVIOUS NEXT
Tagged: #add #digits #java
ADD COMMENT
Topic
Name
7+6 =