Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main ()
- {
- int x,r1,cifra,r2,p1,p2,diferenta;;
- cin>>x;
- r1=0;
- p1=1;
- r2=0;
- p2=1;
- do
- {
- cifra=x%10;
- {
- if(cifra%2==0)
- {
- r1=r1+cifra*p1;
- p1=p1*10;
- }
- else
- {
- r2=r2+cifra*p2;
- p2=p2*10;
- }
- x=x/10;
- }
- }
- while(x>0);
- diferenta=abs(r1-r2);
- cout<<diferenta;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement