Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,i,S,cx,k=0;
- do
- {
- cin>>x;
- if (x!=0) {
- cx=x;
- i=2;
- S=0;
- do
- {
- if (cx%i==0)
- S+=cx%10;
- cx/=10;
- } while (i<=cx/2);
- if (x==S) {
- k++;
- cout<<"DA"<<endl;
- }
- else
- cout<<"NU"<<endl;
- }
- } while (x!=0);
- cout<<"k="<<k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement