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

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

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to show the change in position of a cursor using c

1076


Explain what is a static function?

1115


Why is python slower than c?

1096


how to find anagram without using string functions using only loops in c programming

3197


In C programming, what command or code can be used to determine if a number of odd or even?

1068


How do you construct an increment statement or decrement statement in C?

1243


What is extern storage class in c?

1007


What are comments and how do you insert it in a C program?

1260


What is string constants?

1160


What is a static function in c?

1180


Explain what is a program flowchart and explain how does it help in writing a program?

1103


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

3235


What are valid operations on pointers?

1212


Explain heap and queue.

1100


How are 16- and 32-bit numbers stored?

1293