Lucian_Adrian

#871 Inlocuire2

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