Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n, n1 = 0, n2 = 0, d, a, c1=1, c2=1;
- cin >> n;
- do{
- a = n%10;
- if(a%2==0){
- n2=n2+c2*a;
- c2*=10;
- }
- else{
- n1=n1+c1*a;
- c1*=10;
- }
- n/=10;
- }while(n!=0);
- if(n1 > n2){
- d = n1 - n2;
- }
- else{
- d = n2 - n1;
- }
- cout << d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement