C++ Array | Sololearn: Learn to code for FREE!
0

C++ Array

How to multiply all element in standard one line array.

30th Mar 2017, 3:46 PM
Muhamad Fariq
Muhamad Fariq - avatar
2 Answers
0
In the for loop that goes from the first to the last element multiple a number previously set to a value of 1 with each element. I don't know c++ but I will write a basic syntax which I hope you will understand int num = 1; for( /*stuff that goes in the for loop definition*/) { num = num * arrayElement[position]; }
30th Mar 2017, 5:15 PM
Dextozz
Dextozz - avatar
0
thanks
30th Mar 2017, 10:45 PM
Muhamad Fariq
Muhamad Fariq - avatar