ralitsa_d

StopNumber

Feb 8th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P06_StopNumber {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6.  
  7. int end = Integer.parseInt(scan.nextLine());
  8. int start = Integer.parseInt(scan.nextLine());
  9. int stop = Integer.parseInt(scan.nextLine());
  10.  
  11. for (int i = start; i >= end; i--) {
  12.  
  13. if(i % 2 == 0 && i % 3 == 0){
  14. if(i == stop){
  15. break;
  16. }
  17.  
  18. System.out.print(i + " ");
  19. }
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment