#include<iostream>
#include<conio.h>
using namespace std;
void decimalTObinary(int
number);
int main()
{
int decimal_number = 0;
cout
<< "\n\n\t___ Program to convert decimal
number into binary using Recursion ___\n\n\n";
cout
<< "
Enter the Decimal Number - ";
cin
>> decimal_number;
cout
<< "\n\n\t\t___ Binary Equivalent of
Decimal number " << decimal_number << " is ";
decimalTObinary(decimal_number);
cout
<< "
__";
getch();
}
void decimalTObinary(int
number)
{
if (number != 0)
{
decimalTObinary(number
/ 2);
cout
<< number % 2;
}
}
No comments:
Post a Comment