Skip to main content
3 of 8
fix code to work

#C, 205 201 bytes This will compile with warnings as C89, & I don't believe it's valid C99, but it ends up being smaller than HatsuPointerKun's version, as it saves bytes by ommitting #include's, not using dynamic lengths to printf as they're unneeded, & using log10() to calculate the number of ='s needed:

#define O printf("%5d %c%9d%c\n",a,a%2?32:91,b,a%2?32:93)
r,i;m(a,b){r=0;char p[20];while(a>1){O;r+=a%2*b;a/=2;b*=2;}O;r+=b;memset(p,0,20);memset(p,61,(int)log10(r)+3);printf("%5c%12s\n%16d",32,p,r);}

As my number is 64586, I used this test program to calculate 64 * 586:

#include <stdio.h>
int m(int a, int b);
int main(void)
{
    m(64, 586);
    putchar('\n');
}

& it outputs:

   64 [      586]
   32 [     1172]
   16 [     2344]
    8 [     4688]
    4 [     9376]
    2 [    18752]
    1      37504
          =======
           37504

###edit saved 4 bytes by the "implicit int" rule