Sum and product of an array: Difference between revisions
Content added Content deleted
m (add link to Delphi for pascal) |
(Added Vala Code) |
||
Line 1,475: | Line 1,475: | ||
product=15 |
product=15 |
||
sum=120</lang> |
sum=120</lang> |
||
=={{header|Vala}}== |
|||
<lang vala> |
|||
public static void main(){ |
|||
int sum = 0, product = 1; |
|||
int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; |
|||
foreach (int number in array){ |
|||
sum += number; |
|||
product *= number; |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|XSLT}}== |
=={{header|XSLT}}== |