centered-15 java
public class iscentred15 {
public static void main(String[] args) {
int a[]={3, 2, 10, 4, 1, 6, 9};
int result=f(a);
System.out.println(result);
}
private static int f(int[] a){
for (int i = 0; i <=(a.length / 2); i++) {
int sum = 0;
for (int j = i; j < (a.length - i); j++) {
sum += a[j];
}
if (sum == 15)
return 1;
}
return 0; }
}