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 role of && operator in a program code?
What is the modulus operator?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Is it possible to have a function as a parameter in another function?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
Do character constants represent numerical values?
Who is the main contributor in designing the c language after dennis ritchie?
What is sorting in c plus plus?
Explain what will the preprocessor do for a program?
Is main is a keyword in c?
Explain about C function prototype?
How do you do dynamic memory allocation in C applications?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
How do you write a program which produces its own source code as output?
I have seen function declarations that look like this