Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: Bitwise Operator

Home > Programs > Bitwise Operator

6 / 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: