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.
Had the same Idea, than I tohught about using arrays, as it would be easier to modify number of integers we would like to input and than printout to console.
System.out.println("Input integers");
Scanner readIntegers = new Scanner(System.in);
int[] Integers;
Integers = new int[3];
for(int i=0; i<3 ; i++){
Integers [i] = readIntegers.nextInt();
}
readIntegers.close(); //It's not necessary, as the input Loop is set to run 3 times only
System.out.println("Output integers");
for(int i=0 ; i<3 ; i ++){
System.out.println(Integers[i]);
}
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 →
Had the same Idea, than I tohught about using arrays, as it would be easier to modify number of integers we would like to input and than printout to console.