+ 19

arrays

Guys somebody please show me a program that calculate and return the multiplication product of the array elements.

27th Oct 2016, 11:32 AM
Corne
Corne - avatar
2 Respostas
+ 16
int mult=1; for(int i=0;i<arr.length;i++) { mult*=arr[i]; } return mult;
27th Oct 2016, 11:46 AM
Remmae
Remmae - avatar
+ 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 ; }
15th Jun 2017, 12:11 AM
Furqan Khan
Furqan Khan - avatar