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 is typedf?
Explain the difference between #include "..." And #include <...> In c?
Can variables be declared anywhere in c?
What is the difference between mpi and openmp?
Explain b+ tree?
How do we declare variables in c?
What does *p++ do?
Explain what header files do I need in order to define the standard library functions I use?
How to establish connection with oracle database software from c language?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
What does emoji p mean?
What are different types of pointers?
What is the purpose of type declarations?
What is formal argument?
What are identifiers c?