(URI) Seis Números Ímpares - Solution
import java.io.*;
class Main {
public static void process() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int count = 0;
for (int i = num; count < 6; i++) {
if (i%2 == 1) {
count++;
System.out.println(i);
}
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
class Main {
public static void process() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine());
int count = 0;
for (int i = num; count < 6; i++) {
if (i%2 == 1) {
count++;
System.out.println(i);
}
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
Comments
Post a Comment