how to write a prog in c to convert decimal number into
binary by using recursen function,

Answer Posted / madhavi

void decitobin(int n);

main()
{
int n;
printf("Enter an integer:");
scanf("%d",&n);
decitobin(n);
}

void decitobin(int n)
{
if(n>0)
{
decitobin(n/2);
printf("%d",n%2);
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the function of this pointer?

681


What does c in a circle mean?

587


How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

616


Why is it that not all header files are declared in every C program?

687


What is the size of enum in c?

625






What is the difference between declaring a variable and defining a variable?

726


What is function prototype in c language?

619


Are there constructors in c?

600


How is = symbol different from == symbol in c programming?

618


What does it mean when a pointer is used in an if statement?

608


How is a pointer variable declared?

596


What is the difference between volatile and const volatile?

571


Can you explain the four storage classes in C?

646


Why we use void main in c?

601


What is bash c?

562