Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Test10 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.println("Input number: ");
- int i = scanner.nextInt();
- int s = 0;
- while (i != 0) {
- s += i % 10;
- i /= 10;
- }
- System.out.println(s + i);
- }
- }
Add Comment
Please, Sign In to add comment