long multiply_16bit(unsigned int a, unsigned int b);
int divide_16bit(int dividend, int divisor);
long product;
int quotient;
// Main Function
int main()
{
unsigned int a = 1000;
unsigned int b = 2000;
int dividend = 10000;
int divisor = 200;
// 16位乘法
product = multiply_16bit(a, b);
printf("16位乘法结果: %u\n", product);
// 16位除法
quotient = divide_16bit(dividend, divisor);
printf("16位除法结果: %d\n", quotient);
while (1)
{
}
}
// 16位乘法函数
long multiply_16bit(unsigned int a, unsigned int b)
{
return (unsigned long)a * b;
}
// 16位除法函数
int divide_16bit(int dividend, int divisor)
{
if (divisor == 0)
{
// 处理除零错误
return 0;
}
return dividend / divisor;
}
|