Mathematically Find Max Value without Conditional Comparison

前端 未结 14 630
暗喜
暗喜 2020-12-03 03:39

----------Updated ------------

codymanix and moonshadow have been a big help thus far. I was able to solve my problem using the equations and instead of using right

14条回答
  •  无人及你
    2020-12-03 04:05

    please look at this program.. this might be the best answer till date on this page...

    #include 
    
    int main()
    {
        int a,b;
        a=3;
        b=5;
        printf("%d %d\n",a,b);
        b = (a+b)-(a=b); // this line is doing the reversal
        printf("%d %d\n",a,b);
        return 0;
    }
    

提交回复
热议问题