SelinD

131

May 16th, 2019
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,s=0,c,f=9;
  6. cin>>n;
  7. while(n>0)
  8. {
  9. s=s+n%10*f;
  10. n=n/10;
  11. f--;
  12. }
  13.  
  14. for(c=0; c<=9; c++)
  15. {
  16. if((s+c*10)%11==0)
  17. {
  18. cout<<c<<" ";
  19. break;
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment