Lucian_Adrian

#3078 prod_k

Oct 12th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, P=1,k,ex=0,c;
  6. cin>>n>>k;
  7. while(n>0)
  8. {
  9. c=n%10;
  10. n=n/10;
  11. if(c!=k)
  12. {
  13. ex=1;
  14. P=P*c;
  15. }
  16. }
  17. if(ex==0)cout<<0;
  18. else cout<<P;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment