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 will you find a duplicate number in a array without negating the nos ?

2085


What are the complete rules for header file searching?

1032


What is a macro in c preprocessor?

1056


Explain how does flowchart help in writing a program?

1064


What does c mean before a date?

1109


Why pointers are used?

1026


What is operator precedence?

1152


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

3174


Explain what is meant by 'bit masking'?

1123


Explain how can I convert a number to a string?

1103


What is difference between %d and %i in c?

1183


What are two dimensional arrays alternatively called as?

1136


What is actual argument?

1006


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1359


Write a c program to demonstrate character and string constants?

2117