Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.  
  6. int a=0, i;
  7. scanf("%d", &a);
  8. while(a!=1)
  9. {
  10. if(a%2==0)
  11. {
  12. a/=2; //alternatywnie: a=a/2; :)
  13. printf("%d\n", a);
  14. }
  15.  
  16.  
  17. else
  18. {
  19. a*=3;a++;//albo a=a*3+1;
  20.  
  21. printf("%d\n", a);
  22. }
  23. }
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. return 0;
  31.  
  32. }
Add Comment
Please, Sign In to add comment