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 is c so powerful?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
What is union and structure in c?
Explain what header files do I need in order to define the standard library functions I use?
Explain can static variables be declared in a header file?
how do you programme Carrier Sense Multiple Access
How can I delete a file?
What is a const pointer in c?
What are linked lists in c?
Explain #pragma statements.
How important is structure in life?
How can I do peek and poke in c?
What does it mean when a pointer is used in an if statement?
What happens if a header file is included twice?
What is the use of clrscr?