• C++
    Вычислить сумму n слагаемых
    cosx - cosx^2 + cosx^3 + cosx^4 - cosx^5 + cosx^6 + cosx^7 - cosx^8 + ...

Ответы 1

  • #include <iostream>#include <cmath>using namespace std;void main(){double result ; int x,n=0,k = 2; cin >> x >> n; result = cos(pow(x, 1));for (int i = 2;i<=n;++i) { if (i != k) result += cos(pow(x, i)); else { result -= cos(pow(x, i)); k += 3; } }cout << "result = " << result; system("pause");}
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years