Sum and product of an array: Difference between revisions
Content deleted Content added
m added a ;Task: section header. |
No edit summary |
||
Line 2,757:
=={{header|Vala}}==
<lang
int sum=0, prod = 1;
prod *= val;
}
▲ foreach (int number in array){
print(@"sum: $(sum)\nproduct: $(prod)");
▲ sum += number;
}</lang>▼
{{out}}
<pre>sum: 10
product: 24</pre>
▲</lang>
=={{header|VBA}}==
|