Answer Posted / abhishek karnani
Here is a prgm to convert a decimal number to any base just
replace 2 by the base number of the desired number
#include<stdio.h>
#include<conio.h>
void main()
{
int d;
int i=0,n,j,b[100];
clrscr();
printf("\nEnter decimal number: ");
scanf("%d",&n);
while (n>0)
{
b[i]=n%2;
n=n/2;
i++;
}
printf("\nBinary is: ");
for (j=i-1;j>=0;j--)
{
printf("%d",b[j]);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Why do we use main function?
Explain the properties of union.
Why we not create function inside function.
What are multibyte characters?
What are local static variables? How can you use them?
What are the types of type qualifiers in c?
How do I get a null pointer in my programs?
Not all reserved words are written in lowercase. TRUE or FALSE?
Tell me the use of bit field in c language?
In a byte, what is the maximum decimal number that you can accommodate?
Explain about the functions strcat() and strcmp()?
write a program fibonacci series and palindrome program in c
Explain bit masking in c?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What are the key features in c programming language?