1234567891011121314151617181920212223 |
-
- /**
- * Write a description of class SumOfInput here.
- *
- * @author Zavon Malone
- * @version 10/21/18
- */
- import java.util.Scanner;
- public class SumOfInput
- {
- public static void sumOfInput(String args[]){
- int i, n, sum = 0;
- Scanner num = new Scanner (System.in);
- System.out.print("Enter number");
- i = num.nextInt();
- while(i>0){
- n = i % 10;
- sum = sum + n;
- i = i / 10;
- }
- System.out.println("Number Sum "+sum);
- }
- }
|