74. To swap nibble of a given char data ( Method 2 )
#include<stdio.h>
void
main()
{
char ch,i,j,n1,n2;
printf("To swap nibble of a given
char data \n");
printf("Enter a number : ");
scanf("%d",&ch);
for(i=7;i>=0;i--)
printf("%d",ch>>i&1);
printf("\n");
n1=ch>>4;
n2=ch<<4;
ch=n1|n2;
for(i=7;i>=0;i--)
printf("%d",ch>>i&1);
printf("\n");
}
Comments
Post a Comment