#include <iostream>
#include <cmath>
using namespace std;
long long convert(int);
long long convert(int n) {
long long bin = 0;
int rem, i = 1;
while (n!=0) {
rem = n % 2;
n /= 2;
bin += rem * i;
i *= 10;
}
return bin;
}
Decimal to Binary
Codiga's C++ RecipesConvert decimal to binary number
0 Comments
Add Comment
Log in to add a comment