#include <iostream.h>
#include <conio.h>
void binary(unsigned long int decimal)
{
int remainder;
if (decimal <= 1)
{
cout<< decimal;
return;
}
remainder = decimal % 2;
binary(decimal >> 1);
cout<< reminder;
}
int main()
{
unsigned long int num;
clrscr();
cout<< "Enter decimal";
cin>> num;
cout<< endl<< "Binary of "<< num<< "is " ;
binary(num);
return 0;
}
No comments:
Post a Comment
If you have any doubt please let me know