Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. unsigned long remove_least (unsigned long x) {
  4.     unsigned int least = 0xF, x1, i = 0, res = 0;
  5.  
  6.     for (x1 = x; x1;) {
  7.         if ((x1 & 0xF) < least) least = x1 & 0xF;
  8.         x1 >>= 4;
  9.     }
  10.  
  11.     for (x1 = x; x1;) {
  12.         if ((x1 & 0xF) != least) {
  13.             res |= ((x1 & 0xF) << i);
  14.             i += 4;
  15.         }
  16.         x1 >>= 4;
  17.     }
  18.  
  19.     return res;
  20. }
  21.  
  22. int main() {
  23.     printf("%lX\n", remove_least(0x6274272));
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement