Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double a, x;
- int k;
- cout << "Etner A: ";
- cin >> a;
- cout << "Enter K: ";
- cin >> k;
- if (k <= 0 && k % 2 != 0) {
- cout << "K must be positive and even";
- return 0;
- }
- cout << "Enter X: ";
- cin >> x;
- double summary = 1;
- for (int i = 2; i <= k; i += 2) {
- if (i == 2) {
- summary = (a - x / double(i)) * (a - x / double(i));
- } else {
- summary = (summary - x / double(i)) * (summary - x / double(i));
- }
- }
- summary *= 5.0;
- summary -= 3.0;
- cout << summary;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement