[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Bitwise Operator

Home > Programs > Bitwise Operator

17 / 15

Write an efficient program to swap the nibbles in a byte

Answer:

#include 
#include
using namespace std;
/* function : swapTwoNibbles, to swap two nibbles of a given byte.*/
unsigned char swapTwoNibbles(unsigned char n)
{
    unsigned char num;
    num= ( (n & 0x0F)4 );
    return num;

int main()
{
    unsigned char number;
    unsigned char revNumber;
      coutnumber;
    revNumber=swapTwoNibbles(number);
    cout

Asked In ::

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here: