#include<bits/stdc++.h>
using namespace std;
int mul(int x, int y)
{
return x*y;
}
int main()
{
int n;
cout << "Enter Array Size :: ";
cin >>n;
int a[n];
cout << "\nEnter Array Element :: ";
for(int i=0;i<n;i++)
cin >> a[i];
int multiplication = accumulate(a, a+n, 1, mul);
int substruction = accumulate(a, a+n, 0, minus<int>());
cout << "\nMultiplication :: " << multiplication << "\n";
cout << "\nSubstruction :: " << substruction << "\n";
cout << "\nEnter String Array Size :: ";
cin >> n;
string s[n];
cout << "\nEnter " << n << " String :: ";
for(int i=0;i<n;i++)
cin >> s[i];
cout << "\nString is :: ";
cout << accumulate(s, s+n, string("")) << "\n";
return 0;
}
using namespace std;
int mul(int x, int y)
{
return x*y;
}
int main()
{
int n;
cout << "Enter Array Size :: ";
cin >>n;
int a[n];
cout << "\nEnter Array Element :: ";
for(int i=0;i<n;i++)
cin >> a[i];
int multiplication = accumulate(a, a+n, 1, mul);
int substruction = accumulate(a, a+n, 0, minus<int>());
cout << "\nMultiplication :: " << multiplication << "\n";
cout << "\nSubstruction :: " << substruction << "\n";
cout << "\nEnter String Array Size :: ";
cin >> n;
string s[n];
cout << "\nEnter " << n << " String :: ";
for(int i=0;i<n;i++)
cin >> s[i];
cout << "\nString is :: ";
cout << accumulate(s, s+n, string("")) << "\n";
return 0;
}
Comments
Post a Comment