#include <iostream>
int main()
{
std::cout << "x = ";
int x;
std::cin >> x;
std::cout << "n = ";
int n;
std::cin >> n;
double chislitel=0;
for (int i = 1; i <= n; i++) {
chislitel = chislitel + ((x + sin(i + 2 * x)) / pow(2, i));
}
std::cout << "Answer = " << chislitel / (n + 2) << "\n";
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
int main()
{
std::cout << "x = ";
int x;
std::cin >> x;
std::cout << "n = ";
int n;
std::cin >> n;
double chislitel=0;
for (int i = 1; i <= n; i++) {
chislitel = chislitel + ((x + sin(i + 2 * x)) / pow(2, i));
}
std::cout << "Answer = " << chislitel / (n + 2) << "\n";
return 0;
}