diff --git a/src/conversionOfNumbers/conversionOfNumbers.c b/src/conversionOfNumbers/conversionOfNumbers.c index 1160eab..4c97fbf 100644 --- a/src/conversionOfNumbers/conversionOfNumbers.c +++ b/src/conversionOfNumbers/conversionOfNumbers.c @@ -37,4 +37,16 @@ char* convertIntToBinaryStr(int input){ length--; }while(input != 0); return result; +} + +unsigned int convertBinaryStrToInt(char* input){ + unsigned int result = 0; + int x = 0; + while(input[x] != '\0'){ + if(input[x] == '1'){ + result += 1 * pow(2, x); + } + x++; + } + return result; } \ No newline at end of file