Problem2189--For loop in C++11

2189: For loop in C++11

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

Rewrite the code below using the for each loop construct provided in C++11. int b[5] = {3,4,5,6,7}; int sum = 0; for (int j = 0; j < 5; j++) sum+=b[j];

Output

The summary from 3 to 7

Sample Output Copy

25

Source/Category

17