Skip to content

Commit

Permalink
Create Solved issue rathoresrikant#457
Browse files Browse the repository at this point in the history
  • Loading branch information
YASHYK47 authored Oct 26, 2018
1 parent e2dc926 commit 7d7cd62
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Solved issue #457
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* C Program to Print Binary Equivalent of an Integer using Recursion
*/
#include <stdio.h>

int binary_conversion(int);

int main()
{
int num, bin;

printf("Enter a decimal number: ");
scanf("%d", &num);
bin = binary_conversion(num);
printf("The binary equivalent of %d is %d\n", num, bin);
}

int binary_conversion(int num)
{
if (num == 0)
{
return 0;
}
else
{
return (num % 2) + 10 * binary_conversion(num / 2);
}
}}

0 comments on commit 7d7cd62

Please sign in to comment.