(URI) Conta - Solução
import java.io.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int c = Integer.parseInt(br.readLine());
for (int i = 0; i < c; i++) {
int n = Integer.parseInt(br.readLine());
if (n%2 == 0) {
bw.write("0\n");
}
else {
bw.write("1\n");
}
}
bw.flush();
bw.close();
}
}
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int c = Integer.parseInt(br.readLine());
for (int i = 0; i < c; i++) {
int n = Integer.parseInt(br.readLine());
if (n%2 == 0) {
bw.write("0\n");
}
else {
bw.write("1\n");
}
}
bw.flush();
bw.close();
}
}
Comments
Post a Comment