int converter(int decimalno)
{
int binaryno = 0;
for(int base = 1; decimalno > 0; decimalno /= 2)
{
binaryno += (decimalno % 2) * base;
base *= 10;
}
return binaryno;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter