Risonna

lab3_n1.1

Nov 3rd, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 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)
  26.     {
  27.         if (f == 0)
  28.         {
  29.             while (f == 0)
  30.             {
  31.                 if (d == 0)
  32.                 {
  33.                     break;
  34.                 }
  35.                 else
  36.                 {
  37.                     f = fmod(d, 1);
  38.                     d = f * 10;
  39.                     g = int(d);
  40.                     comp *= g;
  41.                 }
  42.             }
  43.         }
  44.         f = fmod(d, 1);
  45.         d = f * 10;
  46.         g = int(d);
  47.         comp *= g;
  48.     }
  49.     if (comp < 0)
  50.     {
  51.         comp *= -1;
  52.     }
  53.     cout << "Произведение цифр числа=" << comp<<"\n";
  54.     cout << "d=" << d << "\n";
  55.     cout << "s=" << s;
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment