Reverse the bit order in a single macro.
eg. i/p = 10010101 --> o/p = 10101001
Answer Posted / vishnu
with out using strrev
=======================
#include<stdio.h>
#include<conio.h>
int i ;
void binary(int retval[],int num)
{
int k;
while(num >1)
{
k = num;
num =num/2;
retval[i] = k%2;
i++;
}
retval[i] =1;
}
int main()
{
int num;
int bin[20];
scanf("%d",&num);
binary(bin,num);
for(num=i;num >=0;num--)
printf("%d",bin[num]);
printf("\n");
for(num =0;num<=i;num++)
printf("%d",bin[num]);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What is structure of c program?
Do you have any idea how to compare array with pointer in c?
How can I list all of the predefined identifiers?
List the difference between a While & Do While loops?
What is the use of linkage in c language?
Explain how can you avoid including a header more than once?
What is wrong in this statement?
What are the advantages of the functions?
What are reserved words?
Explain what is #line used for?
What is the difference between typedef struct and struct?
What does malloc () calloc () realloc () free () do?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
How many header files are in c?