Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. Scanner scanner = new Scanner(System.in);
  2. int kolkko = Integer.parseInt(scanner.nextLine());
  3. int obshto = 0;
  4. int takova = 0;
  5. boolean toe = false;
  6. for (int ch = 1; ch <= kolkko; ch++) {
  7.     takova = ch;
  8.     while (ch > 0) {
  9.         obshto += ch % 10;
  10.         ch = ch / 10;
  11.     }
  12.     toe = (obshto == 5) || (obshto == 7) || (obshto == 11);
  13.     System.out.printf("%d -> %b%n", takova, toe);
  14.     obshto = 0;
  15.     ch = takova;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement