Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. int num, somaPares, dig, x;
  2. somaPares = 0;
  3. Scanner ler = new Scanner(System.in);
  4. do {
  5. num = ler.nextInt();
  6. x = num;
  7. while (num > 0) {
  8. dig = num % 10;
  9. if (dig % 2 == 0) {
  10. somaPares = somaPares + dig;
  11. }
  12. num = num / 10;
  13. }
  14. // System.out.println("A soma dos numeros pares é" + somaPares);
  15. System.out.println(somaPares);
  16. somaPares = 0;
  17. } while (x > 0);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement