Advertisement
Olivki

adasda

Oct 9th, 2014
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner ob = new Scanner(System.in);
  8.         String[] kony = ob.nextLine().split(" ");
  9.         int inputOne = Integer.parseInt(kony[0]);
  10.         int inputTwo = Integer.parseInt(kony[1]);
  11.  
  12.         // First shit
  13.         System.out.println("First iteration");
  14.         for (int numbers = inputOne; numbers < inputTwo; numbers++) {
  15.             if (shouldPrint(numbers, inputOne) && shouldPrint(numbers, inputTwo))
  16.                 System.out.println("" + numbers);
  17.         }
  18.  
  19.         //Second shit
  20.         System.out.println("Second iteration");
  21.         for (int numbers = inputTwo; numbers > inputOne; numbers--) {
  22.             if (shouldPrint(numbers, inputOne) && shouldPrint(numbers, inputTwo))
  23.                 System.out.println("" + numbers);
  24.         }
  25.     }
  26.  
  27.     public static boolean shouldPrint(final int input, final int number) {
  28.         return input != number;
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement