#include<stdio.h>
#include<conio.h>
main()
{
int n;
clrscr();
printf("\nEnter any decimal no.:");
scanf("%i",&n);
printf("\nBinary equivalent of %d =");
convert(n);
getch();
}
int convert(int x)
{
int i;
if (x==0)
return(0);
i=x%2;
convert(x/2);
printf(" %d",i);
}
#include<conio.h>
main()
{
int n;
clrscr();
printf("\nEnter any decimal no.:");
scanf("%i",&n);
printf("\nBinary equivalent of %d =");
convert(n);
getch();
}
int convert(int x)
{
int i;
if (x==0)
return(0);
i=x%2;
convert(x/2);
printf(" %d",i);
}
read about Decimal to Binary
No comments:
Post a Comment