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
What is the difference between variable declaration and variable definition in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Explain what are multidimensional arrays?
Why doesnt this code work?
What is a program flowchart and how does it help in writing a program?
What is the -> in c?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What is the size of a union variable?
What are # preprocessor operator in c?
cavium networks written test pattern ..
What is pre-emptive data structure and explain it with example?
What does sizeof return c?
Explain a file operation in C with an example.
How can I swap two values without using a temporary?