#include <iostream>
using namespace std;
int main()
{
long dec,rem,i=1,sum=0;
cout<<"Enter the decimal to be converted:";
cin>>dec;
while(dec>0)
{
rem=dec%2;
sum=sum + (i*rem);
dec=dec/2;
i=i*10;
};
cout<<"The binary of the given number is:"<<sum<<endl;
return 0;
}
//ahmed shuvo969
using namespace std;
int main()
{
long dec,rem,i=1,sum=0;
cout<<"Enter the decimal to be converted:";
cin>>dec;
while(dec>0)
{
rem=dec%2;
sum=sum + (i*rem);
dec=dec/2;
i=i*10;
};
cout<<"The binary of the given number is:"<<sum<<endl;
return 0;
}
//ahmed shuvo969
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন