Decimal to Binary - GDB online Debugger | Code, Compile, Run, Debug online C, C++

PHOTO EMBED

Thu Sep 19 2024 23:43:17 GMT+0000 (Coordinated Universal Time)

Saved by @realGuyCrimson

int converter(int decimalno)
{
    int binaryno = 0;
    
    for(int base = 1; decimalno > 0; decimalno /= 2)
    {
        binaryno += (decimalno % 2) * base;
        base *= 10;
    }
    
    return binaryno;
}
content_copyCOPY

https://www.onlinegdb.com/edit/sXLBZW-Wda