+ 1
How to multiple all members of the array?
6 Respuestas
+ 5
#include <iostream>
using namespace std;
int main() {
int a[]={1,2,3,4};
int multiply = 1;
for(int x : a)
multiply*=x;
cout << multiply;
return 0;
}
+ 4
How about this?
int a[] = { 1, 2, 3 };
for(auto &i : a)
++i;
0
I think you mean multiply:
int main() {
int arr[] = {2, 3, 4};
int total = 1;
for (int num: arr) {
total *= num;
}
return 0;
}
0
sorry
0
I try to do this if a[]={1,2,3}
to make members a[]++
and then members is 2,3,4
0
how to that