Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner ob = new Scanner(System.in);
- String[] kony = ob.nextLine().split(" ");
- int inputOne = Integer.parseInt(kony[0]);
- int inputTwo = Integer.parseInt(kony[1]);
- // First shit
- System.out.println("First iteration");
- for (int numbers = inputOne; numbers < inputTwo; numbers++) {
- if (shouldPrint(numbers, inputOne) && shouldPrint(numbers, inputTwo))
- System.out.println("" + numbers);
- }
- //Second shit
- System.out.println("Second iteration");
- for (int numbers = inputTwo; numbers > inputOne; numbers--) {
- if (shouldPrint(numbers, inputOne) && shouldPrint(numbers, inputTwo))
- System.out.println("" + numbers);
- }
- }
- public static boolean shouldPrint(final int input, final int number) {
- return input != number;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement