Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. void main(void)
  2. {
  3. //Declare below a 8-bit unsigned number called foo
  4.  
  5. foo = 0xAB;
  6.  
  7. // Declare any additional variables if needed
  8.  
  9.  
  10.  
  11.  
  12. //Initialize foo to the hexadecimal value AB
  13.  
  14.  
  15.  
  16. //Write code (possibly more than 1 line) to swap the
  17. // lower and upper 4-bits of foo; After executing your
  18. // statements foo should have the value BA in hex.
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. // The following if-then-else statement
  26. // prints the success or failure of your swap code written above
  27. if (foo == 0xBA) {
  28. printf(“Output of Homework 2: Swap Successful”);
  29. else {
  30. printf(“Output of Homework 2: Swap Failed");
  31. }
  32.  
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement