Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- void main()
- {
- const int N = 15;
- int x[N] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
- double y[N], ysum = 0;
- int xmin = INT32_MAX;
- cout << "{x} = ";
- for (int i = 0; i < N; i++) {
- if (x[i] < xmin)
- xmin = x[i];
- cout << x[i] << " ";
- }
- cout << endl;
- if (xmin != 0) {
- cout << "{y} = ";
- for (int i = 0; i < N; i++) {
- y[i] = pow(x[i], 3) / (xmin * 1.0);
- cout << y[i] << " ";
- ysum += y[i];
- }
- cout << endl << "sum of odd {y} by indexes = " << ysum << endl;
- }
- else {
- cout << "Series {y} is equal to inf" << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement