(URI) Resto da Divisão - Solution

import java.io.*;

class Main  {
    public static void process() throws NumberFormatException, IOException {   
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
               
        int num1 = Integer.parseInt(br.readLine());
        int num2 = Integer.parseInt(br.readLine());
       
        if (num1 > num2) {
            int tmp = num1;
            num1 = num2;
            num2 = tmp;  
        }
       
        for (int i = num1+1; i < num2; i++) {
            if (i%5 == 2 || i%5 == 3) {
                System.out.println(i);
            }
        }
       
        return;
    }
   
    public static void main(String[] args) throws NumberFormatException, IOException {
        Main m = new Main();
        m.process();

        System.exit(0);
    }
}

Comments

Popular posts from this blog

(Coderbyte) Dash Insert II - Solução

(Coderbyte) Run Length - Solução

(Coderbyte) Counting Minutes I - Solução