অ্যারে পণ্য খুঁজে বের করার জন্য এটি C++ প্রোগ্রামের একটি উদাহরণ।
অ্যালগরিদম
Begin Initialize the values of array. Call used defined function accumulate to return the product of array. Print the solution. End.
উদাহরণ কোড
#include <iostream>
#include <numeric>
using namespace std;
int ProductOfArray(int p[], int n) {
return accumulate(p, p + n, 1, multiplies<int>());
}
int main() {
int m[] = {6,7 };
int n = sizeof(m) / sizeof(m[0]);
cout <<"Product of the Array is:" <<ProductOfArray(m, n);
} আউটপুট
Product of the Array is:42