SHARE
TWEET

Untitled

a guest Nov 19th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void inserare(int &n)
  2. {
  3.     int v[11], j=-1, i, dif;
  4.     int m=n;
  5.     for (i=0; i<11; ++i)
  6.         v[i]=0;
  7.     while (m)
  8.         {
  9.             v[++j]=m%10;
  10.              ++j;
  11.              m=m/10;
  12.         }
  13.         for (int i=1; i<j-1; i+=2)
  14.             {
  15.                 dif=v[i+1]-v[i-1];
  16.              if (dif>=0) v[i]=dif;
  17.         else
  18.             v[i]=-dif;
  19.         }
  20.         for (i=j-1; i>=0; --i)
  21.             m=m*10+v[i];
  22.         n=m;
  23. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top