Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;// ||
- int main () {
- int a,b,Sa,Sb,cb,i=0;
- //cout<<"a=";
- cin>>a;//
- b=a;
- while (b!=0)
- {
- Sa=0;
- Sb=0;
- cin>>b;
- //ca=a;
- while (a!=0)
- {
- Sa=Sa+a%10;
- a/=10;
- }
- cb=b;
- while (b!=0)
- {
- Sb=Sb+b%10;
- b/=10;
- }
- if (Sa==Sb)
- i++;
- a=cb;
- b=cb;
- }
- cout<<i;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement