-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArray30.java
More file actions
33 lines (29 loc) · 694 Bytes
/
Array30.java
File metadata and controls
33 lines (29 loc) · 694 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
package array;
/**
* Project Admin -> Husanboy Azamov
* Package Name -> array
* Class Name -> Array30
* Copyright © : 6/23/2022
*/
public class Array30 {
public static void main(String[] args) {
int[] array = {1,2,3,4,6,5,7,2,33,12};
solution(array);
}
/*
5 8 9 2 3 4 1 0 -3 7
9 4 1 0
4
* */
public static void solution(int[] array) {
int count = 0;
for (int i = 0; i < array.length - 1; i++) {
if (array[i] > array[i + 1]) {
System.out.print(array[i] + " ");
count++;
}
}
System.out.println();
System.out.println(count);
}
}