-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArray22.java
More file actions
26 lines (24 loc) · 573 Bytes
/
Array22.java
File metadata and controls
26 lines (24 loc) · 573 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
package array;
/**
* Project Admin -> Husanboy Azamov
* Package Name -> array
* Class Name -> Array22
* Copyright © : 6/23/2022
*/
public class Array22 {
public static void main(String[] args) {
array22(1,4,new int[]{1,2,3,4,5,6,7
});//2,3,4,5
//1+6+7
}
public static void array22(int k, int l, int[] array) {
int sum=0;
for (int i = 0 ; i <k; i++) {
sum+=array[i];
}
for (int j = l+1; j < array.length ; j++) {
sum+=array[j];
}
System.out.println(sum);
}
}