public static void main(String[] args) { 
 int A[] = {1,2,3,4}; 
 int B[] = new int[A.length]; 
 for (int x = 0; x < A.length; x++){ 
 if (x == 0){ 
 B[x] = A[x]; 
 } 
 else{ 
 B[x] = B[x-1] + A[x]; 
 } 
 } 
 for (int w:B){ 
 System.out.println(w); 
 } 
 
 } 
 
}
I created my solution in java. I hope this helps!