Advertisement
STANAANDREY

pb3

Nov 12th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.      unsigned c=0,x=0,c1,p=1,nr=0,uc;
  9.   cout<<"x=";cin>>x;
  10.   cout<<"c=";cin>>c;
  11.   cout<<"c1=";cin>>c1;
  12.   while (x!=0) {
  13.     uc=x%10;
  14.     if (uc==c)
  15.         nr=c1*p+nr;
  16.     else
  17.         nr=uc*p+nr;
  18.     p*=10;
  19.     x/=10;
  20.   }
  21.   cout<<nr;
  22. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement