#K88542. Sum Adjacent Elements
Sum Adjacent Elements
Sum Adjacent Elements
You are given a list of n integers. Your task is to create a new list where each element (except the last one) is the sum of the current element and the next element from the input list. The last element remains unchanged.
For example, if the input list is [1, 2, 3, 4], the output list should be [3, 5, 7, 4], because:
- 1 + 2 = 3
- 2 + 3 = 5
- 3 + 4 = 7
- 4 remains the same
The input is provided via standard input and the output should be printed to standard output.
Note: The number of integers (n) is provided in the first line, followed by a line containing n space-separated integers.
inputFormat
The first line contains a single integer n representing the number of elements in the list.
The second line contains n space-separated integers.
outputFormat
Output the resulting list as n space-separated integers on a single line.
## sample4
1 2 3 4
3 5 7 4
</p>