Though I am adding -1 to the sum before coming out of loop, still I see the below recommendation :
"The program must calculate and display the sum of the entered numbers.
RECOMMENDATION FROM YOUR MENTOR
-1 should be included in the sum."
package com.codegym.task.task04.task0442;
/*
Adding
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int []a = new int[n];
int sum = 0;
for (int i =0; i < n; i++) {
a[i] = sc.nextInt();
if (a[i] == -1){
sum = sum + a[i];
break;
}
else
sum = sum + a[i];
}
System.out.println(sum);
}
}