Advertisement
Derga

Untitled

Oct 6th, 2023
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. bool DoYouWantToCalculateThisAgain() {
  8.  
  9. }
  10.  
  11. bool IsInt(long double number) {
  12.     return true;
  13. }
  14.  
  15. int main() {
  16.     long double x;
  17.     long double alpha;
  18.     cin >> x >> alpha;
  19.  
  20.     do {
  21.         if (IsInt(alpha)) {
  22.             long double sum = 0;
  23.             for (int n = 0; n < int(alpha); ++n) {
  24.                 long double summand = pow(x, 2 * n + 1) / (2 * n + 1);
  25.                 sum += summand;
  26.                 cout << setprecision(15) << n << ' ' << summand << ' ' << sum << ' ' << abs(summand / sum) << '\n';
  27.             }
  28.             cout << sum << '\n';
  29.         } else {
  30.             long double sum = 0;
  31.             long double summand = pow(x, 2 + 1) / (2 + 1);
  32.             while(alpha < )
  33.         }
  34.     } while (DoYouWantToCalculateThisAgain());
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement