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


Please Help Members By Posting Answers For Below Questions

Find MAXIMUM of three distinct integers using a single C statement

622


How can I manipulate individual bits?

604


What is a lookup table in c?

622


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

647


What is hashing in c?

638






What is meant by type casting?

621


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

639


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

648


How are variables declared in c?

597


What is nested structure in c?

604


c program for searching a student details among 10 student details

1648


What do you mean by keywords in c?

621


Explain what is the difference between far and near ?

648


hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?

1654


You have given 2 array. You need to find whether they will create the same BST or not. For example: Array1:10 5 20 15 30 Array2:10 20 15 30 5 Result: True Array1:10 5 20 15 30 Array2:10 15 20 30 5 Result: False One Approach is Pretty Clear by creating BST O(nlogn) then checking two tree for identical O(N) overall O(nlogn) ..we need there exist O(N) Time & O(1) Space also without extra space .Algorithm ?? DevoCoder guest Posted 3 months ago # #define true 1 #define false 0 int check(int a1[],int a2[],int n1,int n2) { int i; //n1 size of array a1[] and n2 size of a2[] if(n1!=n2) return false; //n1 and n2 must be same for(i=0;ia1[i+1]) && (a2[i]>a2[i+1]) ) ) return false; } return true;//assumed that each array doesn't contain duplicate elements in themshelves }

2710