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
What is conio h in c?
Disadvantages of C language.
Explain main function in c?
What is the difference between union and anonymous union?
Lists the benefits of c programming language?
What is the use of function in c?
Is main is user defined function?
Explain what is a stream?
write a c program for swapping two strings using pointer
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
What is a char in c?
What is the purpose of realloc()?
How can I run c program?
Why do we use int main?
What functions are used for dynamic memory allocation in c language?