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 is typedf?

1086


Explain the difference between #include "..." And #include <...> In c?

1001


Can variables be declared anywhere in c?

1053


What is the difference between mpi and openmp?

1235


Explain b+ tree?

1028


How do we declare variables in c?

1027


What does *p++ do?

991


Explain what header files do I need in order to define the standard library functions I use?

1133


How to establish connection with oracle database software from c language?

2165


any "C" function by default returns an a) int value b) float value c) char value d) a & b

1057


What does emoji p mean?

1065


What are different types of pointers?

1034


What is the purpose of type declarations?

1091


What is formal argument?

1106


What are identifiers c?

1034