+ 2
int [] myArr = {3, 8,5,3}; what is the code to multiple the value array from index 0 to 3 ???
2 Réponses
+ 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;
+ 4
int result=1;
int [] myArr = {3,8,5,3};
for (int i=0;i <myArr.length;i++){
resultat *= myArr [i];
}