+ 2

int [] myArr = {3, 8,5,3}; what is the code to multiple the value array from index 0 to 3 ???

1st Jan 2017, 7:41 PM
shakil
shakil - avatar
2 odpowiedzi
+ 7
int result = 1; int myArr[] = {3, 8, 5, 3}; int arrLen = sizeof(myArr)/sizeof(myArr[0]); for (int i = 0; i < arrLen; i++){ result *= myArr[i]; } cout<<result<<endl;
1st Jan 2017, 8:23 PM
Umid Berdiev
Umid Berdiev - avatar
+ 4
int result=1; int [] myArr = {3,8,5,3}; for (int i=0;i <myArr.length;i++){ resultat *= myArr [i]; }
1st Jan 2017, 7:50 PM
Amine M. Boulouma
Amine M. Boulouma - avatar