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 are identifiers in c?
Why c is called procedure oriented language?
How are portions of a program disabled in demo versions?
How do you determine a file’s attributes?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Write a program which returns the first non repetitive character in the string?
What is the difference between fread and fwrite function?
what is bit rate & baud rate? plz give wave forms
What does c mean in standard form?
what do u mean by Direct access files? then can u explain about Direct Access Files?
What is a stream?
to find the closest pair
Is c high or low level?
How many bytes are occupied by near, far and huge pointers (dos)?
What are the advantages and disadvantages of pointers?