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 the size of array float a(10)?
What is an endless loop?
Can you return null in c?
What is the difference between printf and scanf )?
What is keyword in c?
What are the two types of functions in c?
What are local static variables? How can you use them?
What is #include stdlib h?
Is Exception handling possible in c language?
Why void is used in c?
How many levels of pointers have?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
Whats s or c mean?
Define macros.
What are the 5 elements of structure?