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
Write a program to show the change in position of a cursor using c
Explain what is a static function?
Why is python slower than c?
how to find anagram without using string functions using only loops in c programming
In C programming, what command or code can be used to determine if a number of odd or even?
How do you construct an increment statement or decrement statement in C?
What is extern storage class in c?
What are comments and how do you insert it in a C program?
What is string constants?
What is a static function in c?
Explain what is a program flowchart and explain how does it help in writing a program?
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
What are valid operations on pointers?
Explain heap and queue.
How are 16- and 32-bit numbers stored?