Advertisement
Risonna

lab3_n1

Nov 3rd, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include<math.h>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     setlocale(LC_ALL, "RUS");
  7.     int n, d, f, s;
  8.     cout << "n="; cin >> n;
  9.     d = n;
  10.     s = 1;
  11.     while (d > 0 or d<0)
  12.     {
  13.         f = d % 10;
  14.         s *= f;
  15.         d /= 10;
  16.         if(s<0)
  17.         {
  18.             s *= -1;
  19.         }
  20.     }
  21.     cout << "Произведение цифр числа=" << s << "\n";
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement