标签:
// 不用大与小与号,求两数最大值
#include <stdio.h>
int max(int a, int b)
{
int c = a - b;
int d = 1 << 31;
if ((c&d) == 0)
{
return a;
}
else
{
return b;
}
}
int main()
{
printf("%d是大数\n", max(0, 2));
printf("%d是大数\n", max(3, 4));
printf("%d是大数\n", max(-1, 5));
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/zhaoyaqian552/article/details/46696717