Ad

the most effective way to multiply and add one

Code
Diff
  • int multiply_and_add_one(int a, int b) {
        int res = a * b;
        return (((a * b) - (-res)) / 2) + 1;
    }
    
    • int multiply_and_add_one(int a, int b)
    • {
    • return (a*b)+1-1+1-1+1+0+0+0+0;
    • }
    • int multiply_and_add_one(int a, int b) {
    • int res = a * b;
    • return (((a * b) - (-res)) / 2) + 1;
    • }