Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n;
- int x;
- float mult=1;
- float sum=0;
- cout << "Enter n:";
- cin >> n;
- cout << "Enter x:";
- cin >>x ;
- float* a = new float [n] ;
- for (int i = 0; i < n; ++i)
- {
- a[i] = (1 / (i + 1)) + sqrt(abs(x));
- }
- for (int i = 1; i <= n; ++i)
- {
- sum += a[i];
- mult *= a[i];
- }
- cout << "Sum:" << sum << endl;
- cout << "Mult:" << mult << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement