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