daily pastebin goal
1%
SHARE
TWEET

duplicare

a guest Mar 19th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. void duplicare(int n,int &d)
  4. {
  5.     int c=n,v[10000],nr=0,i;
  6.     do
  7.     {
  8.         c=c/10;
  9.         nr=nr+1;
  10.     }
  11.     while (c!=0);
  12.     for (i=nr;i>=1;i--)
  13.     {
  14.         v[i]=n%10;
  15.         n=n/10;
  16.     }
  17.     for (i=1;i<=nr;i++)
  18.     {
  19.         d=d*10+v[i];
  20.         if (v[i]%2==0) d=d*10+v[i];
  21.     }
  22. }
  23. int main()
  24. {
  25.     int n,d=0;
  26.     cin >> n;
  27.     duplicare(n,d);
  28.     cout << d;
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top