Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to exchnage bits in a byte
b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3
please mail me the code if any one know to
rajeshmb4u@gmail.com

Answer Posted / santhi perumal

#include<stdio.h>
#include<conio.h>

int main()
{
int i,number,count=0,a[100];

printf("Enter the number\n");
scanf("%d",&number);

for(i=7;i>=0;i--)
{
if((1<<i) & number)
a[count] = 1;
else
a[count] = 0;

count++;
}

printf("Binary Value of the Given Number is:\n");
for(i=0;i<=7;i++)
{
printf("%d",a[i]);
}
printf("\nReversed Binary Value of the Given Number is:\n");
for(i=0;i<=7;i++)
{
printf("%d",a[7-i]);
}
printf("\n");
}

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does struct work in c?

1062


Explain the difference between malloc() and calloc() in c?

1035


Is a house a shell structure?

1146


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

2001


What are inbuilt functions in c?

1022


How does selection sort work in c?

1023


What are run-time errors?

1098


Explain what is the heap?

1047


Explain spaghetti programming?

1235


Why pointers are used in c?

994


Explain how can I read and write comma-delimited text?

1154


What is the difference between pure virtual function and virtual function?

1106


How do you redirect a standard stream?

1089


How can you increase the allowable number of simultaneously open files?

1139


What is the difference between abs() and fabs() functions?

1104