Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool echilibrat(int n)
- {
- int scp=0,sci=0;
- while(n)
- {
- if(n%10%2)
- sci+=n%10;
- else
- scp+=n%10;
- n/=10;
- }
- if(sci==scp)
- return true;
- return false;
- }
- int main()
- {
- int a,b;
- cin>>a>>b;
- unsigned long long int s=0;
- for(int i=a;i<=b;++i)
- if(echilibrat(i))
- s+=i;
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement