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 does struct work in c?
Explain the difference between malloc() and calloc() in c?
Is a house a shell structure?
please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................
What are inbuilt functions in c?
How does selection sort work in c?
What are run-time errors?
Explain what is the heap?
Explain spaghetti programming?
Why pointers are used in c?
Explain how can I read and write comma-delimited text?
What is the difference between pure virtual function and virtual function?
How do you redirect a standard stream?
How can you increase the allowable number of simultaneously open files?
What is the difference between abs() and fabs() functions?