# include <stdio.h>
#include <conio.h>
void Dec_To_Bin (int num);
void main ()
{
int num;
int base;
clrscr();
printf ("Enter the decimal number to convert it binary.\n");
scanf ("%d", &num);
printf ("The %d in binary is : ", num);
Dec_To_Bin (num);
getch();
}
void Dec_To_Bin (int num)
{
if (num > 1)
{
Dec_To_Bin ((num / 2));
}
printf ("%d", (num % 2));
}
No comments:
Post a Comment