I’m doing a Java activity that prints the Numbers the user Input, and here’s my codes:
System.out.print("Enter How Many Inputs: ");
int num1 = Integer.parseInt(in.readLine());
for (int x = 1; x<=num1;x++){
for (int i = 0 ; i<num1;){
System.out.print("Enter Value #" + x++ +":");
int ctr1 =Integer.parseInt(in.readLine());
i++;
}
}
How can I print all the input numbers? Here’s the result of my code:
Enter How Many Inputs: 5
Enter Value #1:22
Enter Value #2:1
Enter Value #3:3
Enter Value #4:5
Enter Value #5:6
How can I print all this numbers as array. 22,1,3,5,6
I guess this should do it…
NOT TESTED
PRINTING
SORTING
Inside the code block