galinyotsev123

ProgBasicsExam22and23December2018-E05giftsFromSanta

Jan 7th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EP01javabookChristmasPreparation {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);{
  6.  
  7. int N = Integer.parseInt(scanner.nextLine());
  8. int M = Integer.parseInt(scanner.nextLine());
  9. int S = Integer.parseInt(scanner.nextLine());
  10.  
  11. for (int i = M; i >= N; i--)
  12. {
  13. if (i % 2 == 0 && i % 3 == 0 && i != S)
  14. {
  15. System.out.printf("%d ", i);
  16. }
  17. else if (i % 2 == 0 && i % 3 == 0 && i == S)
  18. {
  19. break;
  20. }
  21. }
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment