Ferix

RSOJava#13

Dec 2nd, 2020
410
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.lang.Math;
  2. import java.util.Scanner;
  3. public class MyClass {
  4.     public static void main(String args[]) {
  5.         Scanner input = new Scanner(System.in);
  6.         int intervalStart = input.nextInt();
  7.         int intervalEnd = input.nextInt();
  8.         if(intervalStart < intervalEnd){
  9.             System.out.println("Added 5 to intervalEnd because intervalStart cannot be larger than intervalEnd");
  10.             intervalEnd +=5;
  11.         }
  12.        while(intervalStart > intervalEnd){
  13.            intervalEnd+=10;
  14.        }
  15.         System.out.println("["+intervalStart+","+intervalEnd+"]");
  16.        while(intervalStart <= intervalEnd){
  17.            if(intervalStart % 2 ==0){
  18.                System.out.print(intervalStart + " ");
  19.            }
  20.            intervalStart++;
  21.        }
  22.     }
  23. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×