Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string koral(int k){
  6. if(k==0){
  7. return "";
  8. }else{
  9. if(k%2==0){
  10. koral(k/2);
  11. return +"b";
  12. }else{
  13. koral(k/2);
  14. return +"c";
  15. }
  16. }
  17. }
  18. int main(){
  19. int k;
  20. cout <<"Podaj liczbe korali: ";
  21. cin >> k;
  22. cout << koral(k);
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement