apple2_russian_peasant_mult.../rpm.c
michaelangel007 012c1c71ac Add C example
2020-02-05 09:38:31 -08:00

24 lines
248 B
C

#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 ) );
}