C Program To Convert Decimal To Binary Using Recursion

How to write a C Program To Convert Decimal To Binary Using Recursion in C Programming Language ?

Solution For C Program :

/*C Program To Convert Decimal To Binary Using Recursion*/

#include<stdio.h>
void main()
{
void dectobin(int);
int n;
printf("\nEnter Any Decimal Number : ");
scanf("%d", &n);
dectobin(n);
}
void dectobin(int a)
{
int d;
d = a % 2;
if(a != 0)
{
dectobin(a / 2);
printf("%d", d);
}
}


You may also learn these C Program/Code :

C Program To Swap Two Numbers Without Using Third Variable


Learn More :