+ 19
arrays
Guys somebody please show me a program that calculate and return the multiplication product of the array elements.
2 odpowiedzi
+ 16
int mult=1;
for(int i=0;i<arr.length;i++)
{
mult*=arr[i];
}
return mult;
+ 3
#include <iostream>
using namespace std ;
main
{
int length, num, mult=1 ;
cout << ''Please enter limit for array : " ;
cin >> length ;
arr{length} ;
for (int i=0; i<length; i++)
{
cout << "Enter an element " ;
cin >> num ;
arr{i} = num ;
mult *= arr{i} ;
}
cout << "Your multiplication is " << mult ;
}