SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main ()
  5. {
  6.     int x,r1,cifra,r2,p1,p2,diferenta;;
  7.     cin>>x;
  8.     r1=0;
  9.     p1=1;
  10.     r2=0;
  11.     p2=1;
  12.     do
  13.     {
  14.         cifra=x%10;
  15.         {
  16.             if(cifra%2==0)
  17.             {
  18.                 r1=r1+cifra*p1;
  19.                 p1=p1*10;
  20.             }
  21.             else
  22.             {
  23.                 r2=r2+cifra*p2;
  24.                 p2=p2*10;
  25.             }
  26.             x=x/10;
  27.         }
  28.     }
  29.         while(x>0);
  30.         diferenta=abs(r1-r2);
  31.         cout<<diferenta;
  32.         return 0;
  33. }
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