Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int zerk(int a);
  4. int main (void)
  5.  
  6. {
  7.  
  8. int a,b,c,d,n;
  9. d=1;
  10. printf ("vvedy a \n",a);
  11. scanf ("%d",&a);
  12. c=0;
  13.  
  14. printf ("c=%d\n",zerk(a));
  15.  
  16.  
  17.  
  18.  
  19. return 0;
  20. }
  21. int zerk(int a)
  22. {
  23. int d=1,b=0,n=0,c=0;
  24. while (d<abs(a))
  25. {
  26. d=d*2;
  27. n++;
  28. }
  29. //n=n-1;
  30. printf ("kolichestvo bit: %d\n",n);
  31. for( int i=0; (i<=32); ++i)
  32. {
  33.  
  34. b=(a>>i)&1;
  35. c=c<<1;
  36. c=c|b;
  37. printf("%d\n",b);
  38. printf ("c=%d\n",c);
  39. }
  40.  
  41. return c;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement