-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreverse.java
More file actions
36 lines (30 loc) · 929 Bytes
/
reverse.java
File metadata and controls
36 lines (30 loc) · 929 Bytes
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
public class Main {
public static void arraycc(int numbers[]) {
int fnum = 0, lnum = numbers.length - 1;
while (fnum < lnum) {
// Proper swap logic
int temp = numbers[fnum];
numbers[fnum] = numbers[lnum];
numbers[lnum] = temp;
fnum++;
lnum--;
}
}
public static void pairs(int number[]){
if(int i=0; i<number.length; i++){
int crr = number[i];
if(int j=i+1; j<number.length; j++ ){
System.out.print("("+ crr + ","+ number[j]+")");
}
}
}
public static void main(String[] args) {
int numbers[] = {1, 2, 3, 4, 5, 6};
int number[] = {1, 2, 3, 4, 5, 6};
pairs(number);
arraycc(numbers);
for (int i = 0; i < numbers.length; i++) {
System.out.print(numbers[i] + " ");
}
}
}