Advertisement
Risonna

lab3_n1.2

Nov 3rd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include<math.h>
  2. #include<iostream>
  3. #define pi acos(-1.0)
  4. using namespace std;
  5. int main()
  6. {
  7.     setlocale(LC_ALL, "RUS");
  8.     double x, s, y, a, b, h, i, d, f, comp, g;
  9.     cout << "x="; cin >> x;
  10.     b = pi;
  11.     h = pi / 25;
  12.     a = pi / 5;
  13.     y = ((x * x) - ((pi * pi) / 3));
  14.     i = 1;
  15.     s = 0;
  16.     while(i<999)
  17.     {
  18.         s += (pow(-1, i) * cos(i * x)) / (i * i);
  19.         i++;
  20.     }
  21.     comp = 1;
  22.     d = s;
  23.     f = 1;
  24.     g = 1;
  25.     while (d != 0 and f != 0)
  26.     {
  27.         d = fmod(d, 1);
  28.         f = fmod(d, 1);
  29.         d = f * 10;
  30.         g = int(d);
  31.         comp *= g;
  32.     }
  33.     if (comp < 0)
  34.     {
  35.         comp *= -1;
  36.     }
  37.     cout << "Произведение цифр числа=" << comp<<"\n";
  38.     cout << "d=" << d << "\n";
  39.     cout << "s=" << s;
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement