mirror of
https://github.com/Michaelangel007/apple2_russian_peasant_multiplication.git
synced 2024-10-04 17:57:57 +00:00
24 lines
248 B
C
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 ) );
|
|
}
|
|
|