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
Can a program have two main functions?
What is a substring in c?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
How many header files are in c?
Explain how can a program be made to print the name of a source file where an error occurs?
Explain about block scope in c?
what is different between auto and local static? why should we use local static?
What is a nested formula?
Differentiate between a for loop and a while loop? What are it uses?
What is the difference between memcpy and memmove?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
Explain what is a program flowchart and explain how does it help in writing a program?
What is typeof in c?
What is formal argument?
What are the different types of pointers used in c language?