#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;
}
void main()
{
unsigned long int num;
clrscr();
cout<<"Enter decimal";
cin>> num;
cout<<endl<<"Binary of "<<num<<" is ";
binary(num);
getch();
}
0 comments:
Post a Comment