class Main {
public static void main
(String[] args
) { for (int i
: oddNumbers
(2,
5)) System.
out.
println(i
); }
public static int[] oddNumbers(int l, int r) {
l += 1 - l % 2;
r -= 1 - r % 2;
int odd[] = new int[(r - l) / 2 + 1];
for (int i = 0; i < odd.length; i++) odd[i] = l + (i * 2);
return odd;
}
}
//https://pt.stackoverflow.com/q/225246/101
Y2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykJewoJCWZvciAoaW50IGkgOiBvZGROdW1iZXJzKDIsIDUpKSBTeXN0ZW0ub3V0LnByaW50bG4oaSk7Cgl9CgkKCXB1YmxpYyBzdGF0aWMgaW50W10gb2RkTnVtYmVycyhpbnQgbCwgaW50IHIpIHsKCQlsICs9IDEgLSBsICUgMjsKCQlyIC09IDEgLSByICUgMjsKCSAgICBpbnQgb2RkW10gPSBuZXcgaW50WyhyIC0gbCkgLyAyICsgMV07CgkgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBvZGQubGVuZ3RoOyBpKyspIG9kZFtpXSA9IGwgKyAoaSAqIDIpOwoJICAgIHJldHVybiBvZGQ7Cgl9Cn0KCi8vaHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzIyNTI0Ni8xMDE=