Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int przesun(int n){
  4. int k;
  5. int p;
  6. int w;
  7. printf("Przesun o: ");
  8. scanf("%d", &k);
  9. printf("W lewo[1], czy w prawo[0]: ");
  10. scanf("%d", &p);
  11. if(p){
  12. w = n<<k;
  13. }
  14. w = n>>k;
  15. return w;
  16. }
  17.  
  18. int decbin(int a){
  19. int temp;
  20. for(int i=8; i>=0; i--)
  21. {
  22. temp=a>>i;
  23. if(temp&1){
  24. printf("1");
  25. }
  26. else
  27. {
  28. printf("0");
  29. }
  30. }
  31. }
  32.  
  33. int main()
  34. {
  35. int n;
  36. printf("Podaj l: ");
  37. scanf("%d", &n);
  38. int w = przesun(n);
  39. printf(w);
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement