How to resolve the algorithm Sum and product of an array step by step in the Liberty BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sum and product of an array step by step in the Liberty BASIC programming language
Table of Contents
Problem Statement
Compute the sum and product of an array of integers.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Sum and product of an array step by step in the Liberty BASIC programming language
Source code in the liberty programming language
Dim array(19)
For i = 0 To 19
array(i) = Int(Rnd(1) * 20)
Next i
'product must first equal one or you will get 0 as the product
product = 1
For i = 0 To 19
sum = (sum + array(i))
product = (product * array(i))
next i
Print "Sum is " + str$(sum)
Print "Product is " + str$(product)
You may also check:How to resolve the algorithm Sorting algorithms/Merge sort step by step in the Prolog programming language
You may also check:How to resolve the algorithm Pig the dice game step by step in the Erlang programming language
You may also check:How to resolve the algorithm 24 game step by step in the HicEst programming language
You may also check:How to resolve the algorithm Zumkeller numbers step by step in the Java programming language
You may also check:How to resolve the algorithm Create an HTML table step by step in the Pascal programming language