Advertisement
a53

Cifre004

a53
Oct 14th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int n,s,nrc;
  4.  
  5. int main()
  6. {
  7. cin>>n;
  8. while(n)
  9. s+=n%10,n/=10;
  10. nrc=s;
  11. while(s>9)
  12. cout<<9,s-=9,--nrc;
  13. if(s)
  14. cout<<s,--nrc;
  15. for(int i=1;i<=nrc;++i)
  16. cout<<0;
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement