ValerianBenchea

+++prod_k

May 25th, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1.  prod_k#include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, k, c, P=1;
  8.     bool ok=0;
  9.     cin>>n>>k;
  10.     while(n)
  11.     {
  12.         c=n%10;
  13.         if(c!=k)
  14.         {
  15.             ok=1;
  16.             P=P*c;
  17.         }
  18.         n=n/10;
  19.     }
  20.     if(ok==0)
  21.         cout<<"0";
  22.     else
  23.         cout<<P;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment