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

Explain About fork()?

1119


What are type modifiers in c?

1054


Why header file is used in c?

1097


What library is sizeof in c?

1093


What is the most efficient way to store flag values?

1192


Can we declare a function inside a function in c?

1042


How can you draw circles in C?

1156


what does static variable mean?

1109


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1126


What are the differences between Structures and Arrays?

1216


which is an algorithm for sorting in a growing Lexicographic order

1806


What is const keyword in c?

1165


Explain built-in function?

1137


What is calloc()?

1073


Who developed c language?

1095