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 / ruchi

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int n,r,s=0,i=0;
printf("\nEnter the decimal number ");
scanf("%d",&n);
while(n>0)
{
r=n%2;
n=n/2;
s=s+r*pow(10,i++);
}
printf("\nThe binary equivalent is ");
printf("%d",s);
getch();
}

Is This Answer Correct ?    27 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are identifiers in c?

1199


Why c is called procedure oriented language?

1038


How are portions of a program disabled in demo versions?

1290


How do you determine a file’s attributes?

1075


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1399


Write a program which returns the first non repetitive character in the string?

1116


What is the difference between fread and fwrite function?

1077


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

1976


What does c mean in standard form?

1168


what do u mean by Direct access files? then can u explain about Direct Access Files?

2085


What is a stream?

1133


to find the closest pair

2321


Is c high or low level?

1004


How many bytes are occupied by near, far and huge pointers (dos)?

1153


What are the advantages and disadvantages of pointers?

1066