Advertisement
STANAANDREY

simu2019

Mar 21st, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.  int v[1000],n,i,x=0,inv=0;
  8.  cout<<"n=";cin>>n;
  9.  while (n)
  10.  {
  11.      inv=inv*10+n%10;
  12.      n/=10;
  13.  }
  14.  while (inv)
  15.  {
  16.      v[x]=inv%10;
  17.      x++;
  18.      inv/=10;
  19.  }
  20.   cout<<v[0];
  21.   for (i=1;i<x;i++)
  22.   {
  23.      cout<<abs(v[i-1]-v[i]);
  24.       cout<<v[i];
  25.   }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement