Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = scanner.nextInt();
- int num1 = num / 1000 % 10;
- int num2 = num / 100 % 10;
- int num3 = num / 10 % 10;
- int num4 = num % 10;
- int sum = num1 + num2 + num3 + num4;
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement