Advertisement
slowmindead

Bacnote

Feb 3rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {int s,pp=1,p,k=0,n,m;
  7.     cout<<"dati suma ";
  8. cin>>s;
  9. cout<<"puterile numarului... ";
  10. cin>>n;
  11. cout<<"puterea la care sa ajunga...";
  12. cin>>p;
  13.  
  14. while(k<p)
  15. {pp=pp*n;
  16. k++;}
  17.  
  18. while(s>=0)
  19. {m=s/pp;
  20. cout<<endl;
  21. if(m>0)
  22. {cout<<"s-au folosit "<<m<<" bacnote de "<<pp;}
  23. s=s-(m*pp);
  24. pp=pp/n;
  25.  
  26. }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement