Advertisement
finderabc

Gifts from Santa

Mar 1st, 2020
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. package exam;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class santa {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int n = Integer.parseInt(scanner.nextLine());
  10.         int m = Integer.parseInt(scanner.nextLine());
  11.         int s = Integer.parseInt(scanner.nextLine());
  12.  
  13.         for (int i = m; i > n; i--) {
  14.             if (i % 3 == 0 && i % 2 == 0) {
  15.                 if (i != s) {
  16.                     System.out.printf("%d ", i);
  17.                 } else {
  18.                     break;
  19.                 }
  20.             }
  21.         }
  22.     }
  23. }
  24. RAW Paste Data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement