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 convert binary to decimal and decimal to binary in C
lanaguage

Answer Posted / rahul

[decimal to binary]
#include<stdio.h>
#include<conio.h>
void main()
{
int dec,bin,a[100],i=0,r,j;
printf("enter the decimal number: ");
scanf("%d",&dec);
while(dec>0)
{
r=dec%2;
dec=dec/2;
a[i]=r;
i++;
}
printf("the equivalant binary numberis: ");
for(j=i-1;j>=0;j--)
printf("%d",a[j]);
getch()
}

Is This Answer Correct ?    72 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you access memory located at a certain address?

1059


code for find determinent of amatrix

1911


What is main () in c?

1007


What is the use of ?

990


Who is the founder of c language?

1105


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1846


What is difference between static and global variable in c?

978


How do we open a binary file in Read/Write mode in C?

1175


i want to know the procedure of qualcomm for getting a job through offcampus

2409


When would you use a pointer to a function?

992


How can you draw circles in C?

1097


Explain how can you be sure that a program follows the ansi c standard?

1393


What is NULL pointer?

1034


What is unary operator?

1048


What are formal parameters?

1063