-->
当前位置:首页 > 题库

PROGRAMMING:Using foreach to find the sum of arrays

Luz5年前 (2021-05-10)题库357
Define an integer array a, the length of the array is given by keyboard, and use foreach statement to find the sum of all elements of the array.
###Input format:
Enter the length of the array on the first line
The second line gives the values of each element of the array, separated by spaces
###Output format:
Value of output sum
###Input example:
Here is a set of inputs. For example:
```in
five
1 2 3 4 5
```
###Output example:
The corresponding output is given here. For example:
```out
fifteen
```







answer:If there is no answer, please comment