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
How will you find a duplicate number in a array without negating the nos ?
What are the complete rules for header file searching?
What is a macro in c preprocessor?
Explain how does flowchart help in writing a program?
What does c mean before a date?
Why pointers are used?
What is operator precedence?
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
Explain what is meant by 'bit masking'?
Explain how can I convert a number to a string?
What is difference between %d and %i in c?
What are two dimensional arrays alternatively called as?
What is actual argument?
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.
Write a c program to demonstrate character and string constants?