Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void bin(int N){
  4.  
  5. unsigned int M = 1 << (sizeof(int) * 8 -1); // Legnagyobb helyiértékű bitre van állítva a maszk
  6. while (M != 0){
  7. printf ("%d", (N&M)==0?0:1);
  8. M >>= 1; // M = M >> 1;
  9. }
  10.  
  11. printf ("\n");
  12. }
  13.  
  14. int main(){
  15.  
  16. int a = -5;
  17. bin(a);
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement