Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1137


what is bit rate & baud rate? plz give wave forms

1965


What is static memory allocation?

1159


How can I access an I o board directly?

1079


Do you know null pointer?

1011


Explain a file operation in C with an example.

1109


What is volatile variable in c with example?

1029


Do you know what are the properties of union in c?

1064


Differentiate between a for loop and a while loop? What are it uses?

1164


Tell me the use of bit field in c language?

1052


what is a constant pointer in C

1130


What are the application of void data type in c?

1169


Why do we use null pointer?

1046


Is it better to use a macro or a function?

1146


What is dynamic variable in c?

1015