Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- const int n = 8;
- int l[n] = { 1,2,3,4,5,6,7,8 };
- int min = l[0], max = l[0], b1, b2;
- for (int i = 1; i < n; i++) {
- if (l[i] < min)
- min = l[i];
- if (l[i] > max)
- max = l[i];
- }
- b1 = min * min;
- b2 = max * max * max;
- double s = min * 1.0 / (b1 + b2), s1;
- for (int i = 0; i < n; i++) {
- s1 += l[i] / ((i + 1) * 1.0);
- }
- s *= s1;
- cout << "s = " << s << endl;
- system("pause");
- }
Add Comment
Please, Sign In to add comment