Conversion of decimal to binary using recursion
#include
void bin(int);
void main()
{
int no;
clrscr();
printf("\nEnter a Decimal Number:");
scanf("%d",&no);
printf("\nBinary Equivalent =");
bin(no);
getch();
}
void bin(int no)
{
int r;
if(no!=0)
{
r=no%2;
no=no/2;
bin(no);
printf("%d",r);
}
}
code for Conversion of decimal to binary using recursion
#include
void bin(int);
void main()
{
int no;
clrscr();
printf("\nEnter a Decimal Number:");
scanf("%d",&no);
printf("\nBinary Equivalent =");
bin(no);
getch();
}
void bin(int no)
{
int r;
if(no!=0)
{
r=no%2;
no=no/2;
bin(no);
printf("%d",r);
}
}
code for Conversion of decimal to binary using recursion
0 comments: