Sum and product of an array: Difference between revisions

Sum and product of an array en Yabasic
(Sum and product of an array en True BASIC)
(Sum and product of an array en Yabasic)
Line 3,055:
</xsl:template>
</xsl:stylesheet></lang>
 
 
=={{header|Yabasic}}==
{{trans|QBasic}}
<lang yabasic>dim array(5)
data 1, 2, 3, 4, 5
for index = 1 to arraysize(array(), 1)
read array(index)
next index
 
sum = 0
prod = 1
for index = 1 to arraysize(array(), 1)
sum = sum + array(index)
prod = prod * array(index)
next index
print "The sum is ", sum //15
print "and the product is ", prod //120
end</lang>
 
 
=={{header|zkl}}==
2,130

edits