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
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is the difference between printf and scanf )?
What are the types of i/o functions?
What is a program?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Is c pass by value or reference?
How can I remove the leading spaces from a string?
What is a struct c#?
What are header files why are they important?
Which is the best website to learn c programming?
What is a stream water?
What is difference between structure and union?
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
Explain the advantages of using macro in c language?
What is #include cctype?