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 binary of number?

Answer Posted / abhishek karnani

Here is a prgm to convert a decimal number to any base just
replace 2 by the base number of the desired number


#include<stdio.h>
#include<conio.h>
void main()
{
int d;
int i=0,n,j,b[100];
clrscr();
printf("\nEnter decimal number: ");
scanf("%d",&n);
while (n>0)
{
b[i]=n%2;
n=n/2;
i++;
}

printf("\nBinary is: ");

for (j=i-1;j>=0;j--)
{
printf("%d",b[j]);
}
getch();
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use main function?

1107


Explain the properties of union.

1019


Why we not create function inside function.

2141


What are multibyte characters?

1059


What are local static variables? How can you use them?

1080


What are the types of type qualifiers in c?

1030


How do I get a null pointer in my programs?

1058


Not all reserved words are written in lowercase. TRUE or FALSE?

1176


Tell me the use of bit field in c language?

1015


In a byte, what is the maximum decimal number that you can accommodate?

1068


Explain about the functions strcat() and strcmp()?

989


write a program fibonacci series and palindrome program in c

976


Explain bit masking in c?

1080


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1109


What are the key features in c programming language?

1004