Browse Source

kabrel conver_bintodec

remotes/origin/kabrel
fdai7801 11 months ago
parent
commit
d2a5222a38
  1. 13
      src/main/c/BasicMode.c

13
src/main/c/BasicMode.c

@ -19,3 +19,16 @@ long long int DecToBin(long long int n) {
return bin;
}
// convert binary to decimal
long long int BinToDec(long long int n) {
long long int dec = 0, i = 0, rem;
while (n != 0) {
rem = n % 10;
dec += rem * pow(2, i);
i++;
n /= 10;
}
return dec;
}
Loading…
Cancel
Save