Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class GiftsFromSanta {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int n = keyboard.nextInt();
- int m = keyboard.nextInt();
- int s = keyboard.nextInt();
- for (int i = m; i >= n; i--) {
- if (i % 2 == 0 && i % 3 == 0) {
- if (i == s) {
- break;
- }
- System.out.print(i + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement