Advertisement
icatalin

Untitled

Nov 21st, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. //Se citeste un nr n de la taste, afisati in ordine descrescatoare cifrele numarului, o singura data.
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,cif,i,nn;
  8. cout<<"n=";
  9. cin>>n;
  10.  
  11. for(i=9;i>=0;i--)
  12. {
  13. nn=n;
  14. while(nn!=0)
  15. {
  16. cif=nn%10;
  17. nn=nn/10;
  18. if ( cif==i)
  19. cout<<i;
  20. }
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement