Here is the source code of the C program to find the binary equivalent of the decimal number. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Convert a Number Decimal System to Binary System using Recursion
int dec, bin;
printf("Enter a decimal number: ");
bin = convert(dec);
printf("The binary equivalent of %d is %d.\n", dec, bin);
int convert(int dec)
if (dec == 0)
return (dec % 2 + 10 * convert(dec / 2));
$ cc pgm31.c $ a.out Enter a decimal number: 10 The binary equivalent of 10 is 1010.
Sanfoundry Global Education & Learning Series – 1000 C Programs.