Decimal to Binary Conversion using Recursion

This program converts the Decimal number to Binary Using Recursion. This is a part of Mumbai University MCA Colleges C Program MCA





#include<stdio.h>
#include<conio.h>
void main()
{
int n;
void convert(int num);
clrscr();

printf("Enter the decimal integer : ");
scanf("%d",&n);

printf("Binary equivalent is : ");
convert(n);
getch();
}


void bin_convert(int num)
{
int r;
if(num>0)
{
r=num%2;
num=num/2;
convert(num);
printf("%d",r);
}
}





OUTPUT:

Enter the decimal integer:       9

Binary equivalent is:    1001


Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment