#include<iostream>
using namespace std;
int main()
{
int i, j, a, b[100] = {0};
unsigned long long int s = 0;
cout << "Enter Decimal Number : ";
cin >> a;
cout << endl;
i = 0;
while(a != 0)
{
b[i] = a%2;
a = a/2;
i++;
}
for(j=i-1;j>=0;j--)
{
s = s*10 + b[j];
}
cout << "Binary Number is :: " << s << endl;
return 0;
}
using namespace std;
int main()
{
int i, j, a, b[100] = {0};
unsigned long long int s = 0;
cout << "Enter Decimal Number : ";
cin >> a;
cout << endl;
i = 0;
while(a != 0)
{
b[i] = a%2;
a = a/2;
i++;
}
for(j=i-1;j>=0;j--)
{
s = s*10 + b[j];
}
cout << "Binary Number is :: " << s << endl;
return 0;
}
Comments
Post a Comment