apple2_russian_peasant_mult.../rpm.c

24 lines
248 B
C
Raw Normal View History

2020-02-05 17:38:31 +00:00
#include <stdio.h>
int RPM( int a, int b )
{
int sum = 0;
while( b )
{
if( b & 1 )
sum += a;
a <<= 1;
b >>= 1;
}
return sum;
}
int main()
{
return printf( "%d\n", RPM( 86, 57 ) );
}