C program to implement Russian Peasant

Here is a C program that I wrote years back to implement Russian Peasant method of an interesting multiplication technique –


       int a, b, sum = 0;

       printf("\nEnter the two digits to be multiplied separated by space>> ");
       scanf("%d %d", &a, &b);
       printf("%d ",a);
       printf(" %d\n",b);

          if(a % 2)
             sum += b;
             sum += 0;

          a /= 2;
          b *= 2;

          printf("%d ",a);
          printf(" %d\n",b);
       while(a = 1);

       printf("If you add those numbers on the right column corresponding to an odd number on the left column, \n");
       printf("VERIFIES-------> %d * %d = %d. \n", a,b,sum);