jwrbg

Task8

Feb 20th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task8
  6. {
  7. public static void main(String[] args)
  8. {
  9. Scanner scanner = new Scanner(System.in);
  10. int inputNum = scanner.nextInt();
  11. while (inputNum != 0) {
  12. StringBuilder result = new StringBuilder();
  13. boolean isHere = false;
  14. if (inputNum % 3 == 0) {
  15. result.append("Пльок");
  16. isHere = true;
  17. }
  18. if (inputNum % 5 == 0) {
  19. result.append("Пляс");
  20. isHere = true;
  21. }
  22. if (inputNum % 7 == 0) {
  23. result.append("Пльос");
  24. isHere = true;
  25. }
  26. if (!isHere) {
  27. result.append(inputNum);
  28. }
  29.  
  30. System.out.println(result.toString());
  31. inputNum = scanner.nextInt();
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment