MAIN.JAVA:
import java.io.*;
import java.util.*;
public class Main{
public static void main (String[] args) throws Exception{
int n,sum=0;
Scanner sc =new Scanner(System.in);
System.out.println("Enter n :");
n = sc.nextInt();
int b[] = new int [n];
for(int i=0;i<n;i++) {
b[i] =sc.nextInt();
sum =sum+ b[i];
}
System.out.println("Sum of array elements is : "+sum);
}
}