C program to convert decimal to binary using recursion
Output:
Enter the number to convert to binary: 1034
10000001010
Implementation:
Output:
Enter the number to convert to binary: 1034
10000001010
Implementation:
#include <stdio.h>
void tobinary(int n)
{
int rem;
if(n==0)
return;
tobinary(n/2);
printf("%d",n%2);
}
int main(void) {
int n;
printf("Enter the number to convert to binary:\n");
scanf("%d",&n);
tobinary(n);
return 0;
}