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 pass by value in c?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What are different types of variables in c?
How can I make sure that my program is the only one accessing a file?
What does d mean?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
What are the types of pointers?
How will you divide two numbers in a MACRO?
Where are c variables stored in memory?
What is volatile variable in c?
Write a program to know whether the input number is an armstrong number.
How do you define a string?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Explain what is the advantage of a random access file?
What is the sizeof () a pointer?