Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Lab2 {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int n = s.nextInt();
- int sum = 0;
- for (int i = 0; i < 4; i++) {
- sum = sum + n % 10;
- n = n / 10;
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement