#include <stdio.h>
long Product( long a,long b )
{
long p = 0;
while( a > 0 )
{
if (a % 2 == 1) p += b;
a >>= 1;
b <<= 1;
} //while end
return p;
} //Product()
void main()
{
printf( "%ld\n", Product( 3, 7 ) ); //결과는 3*7=21이다.
}
long Product( long a,long b )
{
long p = 0;
while( a > 0 )
{
if (a % 2 == 1) p += b;
a >>= 1;
b <<= 1;
} //while end
return p;
} //Product()
void main()
{
printf( "%ld\n", Product( 3, 7 ) ); //결과는 3*7=21이다.
}
덧글을 달아 주세요