fork download
  1.  
  2. /* Write a program to swap a nibble */
  3.  
  4. #include <stdio.h>
  5.  
  6. int main(void) {
  7. // your code goes here
  8.  
  9. unsigned int num = 0x0F;
  10. unsigned int num1 = 0xF0;
  11.  
  12. printf("Value 0x%02X", num);
  13.  
  14. num = ((num & 0x0F)<< 4) | ((num & 0xF0)>>4);
  15.  
  16. printf("\nandoperation 0x%02X", num);
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 548KB
stdin
Standard input is empty
stdout
Value 0x0F
andoperation  0xF0