Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num, somaPares, dig, x;
- somaPares = 0;
- Scanner ler = new Scanner(System.in);
- do {
- num = ler.nextInt();
- x = num;
- while (num > 0) {
- dig = num % 10;
- if (dig % 2 == 0) {
- somaPares = somaPares + dig;
- }
- num = num / 10;
- }
- // System.out.println("A soma dos numeros pares é" + somaPares);
- System.out.println(somaPares);
- somaPares = 0;
- } while (x > 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement