Advertisement
STANAANDREY

_5,XII,2018

Dec 5th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.   int x,i,S,cx,k=0;
  9.  
  10.   do
  11.   {
  12.       cin>>x;
  13.       if (x!=0) {
  14.       cx=x;
  15.       i=2;
  16.       S=0;
  17.       do
  18.       {
  19.           if (cx%i==0)
  20.             S+=cx%10;
  21.           cx/=10;
  22.  
  23.       } while (i<=cx/2);
  24.  
  25.       if (x==S) {
  26.          k++;
  27.        cout<<"DA"<<endl;
  28. }
  29.       else
  30.         cout<<"NU"<<endl;
  31.       }
  32.   } while (x!=0);
  33.  
  34. cout<<"k="<<k;
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement