We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public class Main {
public static void main(String[] args) throws IOException {
// Create a BufferedReader to read from stdin
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Read the number of integers
int n = Integer.parseInt(reader.readLine()); // Read the first line and convert it to an integer
// Loop to read and print each integer
for (int i = 0; i < n; i++) {
int num = Integer.parseInt(reader.readLine()); // Read each integer and parse it
System.out.println(num); // Print the integer on a new line
}
// Close the reader
reader.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout I
You are viewing a single comment's thread. Return to all comments →
import java.io.*;
public class Main { public static void main(String[] args) throws IOException { // Create a BufferedReader to read from stdin BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
}