| 34 | import java.util.Scanner; |
| 35 | |
| 36 | public class ArraySum { |
| 37 | |
| 38 | public static int arraySum(int[] arr) { |
| 39 | int n = arr.length; |
| 40 | int sum = 0; |
| 41 | for (int i = 0; i < n; i++) { |
| 42 | sum = sum + arr[i]; |
| 43 | } |
| 44 | return sum; |
| 45 | } |
| 46 | |
| 47 | public static int[] takingInput() { |
| 48 | Scanner sc = new Scanner(System.in); |
| 49 | int n = sc.nextInt(); |
| 50 | int[] arr = new int[n]; |
| 51 | for (int i = 0; i < n; i++) { |
| 52 | arr[i] = sc.nextInt(); |
| 53 | } |
| 54 | return arr; |
| 55 | } |
| 56 | |
| 57 | public static void main(String[] args) { |
| 58 | int[] arr = takingInput(); |
| 59 | int n = arraySum(arr); |
| 60 | System.out.println(n); |
| 61 | } |
| 62 | } |
nothing calls this directly
no outgoing calls
no test coverage detected