-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrays.java
More file actions
56 lines (45 loc) · 1.32 KB
/
arrays.java
File metadata and controls
56 lines (45 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.Scanner;
public class arrays {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
// int a[] = new int[5];
// a[0] = 2;
// a[1] = 3;
// a[2] = 4;
// System.out.println(a[0]+a[1]+a[2]);
// double b[] = new double[5];
// int arr[] = new int[6];
// int sum = 0;
// for(int i =0;i<6;i++){
// arr[i]=sc.nextInt();
// sum = sum +arr[i];
// }
// double avg = sum/arr.length;
// System.out.println(sum);
// System.out.println(avg);
int n = sc.nextInt();
int a[] = new int[n];
for(int i=0 ; i<n;i++ ){
a[i]=sc.nextInt();
}
for(int i =0;i<n/2;i++){
int j = n-i-1;
int t =a[i];
a[i] = a[n-i-1];
a[n-i-1]=t;
}
for(int i =0;i<n;i++){
System.out.print(a[i]+ " ");
}
// int b[] =new int[n];
// for(int i=0;i<n;i++){
// b[i]=a[n-1-i];
// System.out.print(a[n-1-i]+ " ");
// }
// System.out.println();
// int a = sc.nextInt();
// int b = sc.nextInt();
// int c = sc.nextInt();
// System.out.println(a+b+c);
}
}