1 public class TakingInput {
2
3 public static void main(String[] args) {
4
5 Scanner s = new Scanner(System.in);
6
7 System.out.println("enter number of elements");
8
9 int n=s.nextInt();
10
11 int arr[]=new int[n];
12
13 System.out.println("enter elements");
14
15 for(int i=0;i<n;i++){//for reading array
16 arr[i]=s.nextInt();
17
18 }
19
20 for(int i: arr){ //for printing array
21
22 System.out.println(i);
23
24 }
25
26
27 }
28
29}
30
1public static void main (String[] args)
2{
3 Scanner input = new Scanner(System.in);
4 double[] numbers = new double[5];
5
6 for (int i = 0; i < numbers.length; i++)
7 {
8 System.out.println("Please enter number");
9 numbers[i] = input.nextDouble();
10 }
11}
12