Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,aux,s=0,p=0,k=0;
- cin>>n;
- while(n!=0)
- {
- s=s+n%10;
- n/=10;
- }
- aux=s;
- while(s>9)
- {
- cout<<"9";
- k++;
- s=s-9;
- }
- cout<<s;
- while(p<aux-k-1)
- {
- cout<<"0";
- p++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement