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
What is stack in c?
What does 4d mean in c?
Is c procedural or functional?
Is c# a good language?
how we can make 3d venturing graphics on outer interface
What is the symbol indicated the c-preprocessor?
What is void main () in c?
What are the uses of null pointers?
Define recursion in c.
What are the different categories of functions in c?
How will you find a duplicate number in a array without negating the nos ?
Are comments included during the compilation stage and placed in the EXE file as well?
Why do we use namespace feature?
In a switch statement, explain what will happen if a break statement is omitted?
How can I change the size of the dynamically allocated array?