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 can I list all of the predefined identifiers?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Is c high or low level?
Why doesnt that code work?
Explain what is output redirection?
What’s a signal? Explain what do I use signals for?
What are the functions to open and close file in c language?
What is the use of typedef in c?
What is the use of parallelize in spark?
How can I handle floating-point exceptions gracefully?
What are the usage of pointer in c?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What is the difference between variable declaration and variable definition in c?
What is adt in c programming?
Why double pointer is used in c?