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...

how to find the binary of a number?

Answer Posted / alle balraj

void main()
{
int i,n,p=0,j;
int a[10];
clrscr();
printf("Enter the value of n:\n");
scanf("%d",&n);
i=n;
while(i!=1)
{
if(n==1)
{
a[p]=1;
break;
}
if(n%2==0)
{
a[p]=n%2;
}
else
{
a[p]=n%2;
}
n=n/2;
i=n+2;
i--;
p++;
}
for(j=p;j>=0;j--)
{
printf("%d",a[j]);
}

getch();
}

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does c mean?

975


Describe the difference between = and == symbols in c programming?

1298


Write a program to generate random numbers in c?

1048


Why static variable is used in c?

979


Is c procedural or functional?

979


Write a program on swapping (100, 50)

1063


What are the various types of control structures in programming?

1007


please explain every phase in the "SDLC" in the dotnet.

2560


What is hashing in c?

1101


What is the use of function in c?

1142


What are two dimensional arrays alternatively called as?

1133


Where are the auto variables stored?

1090


Are local variables initialized to zero by default in c?

984


Why malloc is faster than calloc?

1014


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2412