Wednesday

What is the answer to the following equation: 48/2(9+3) = ?

If you know how to program,

    cout << 48/2(9+3)    << endl;   // ambiguous question, error: '2' cannot be used as a function
    cout << 48/2*(9+3)   << endl;   // 288
    cout << 48/(2*(9+3)) << endl;   // 2

If you use http://www.wolframalpha.com/input/?i=48%2F2%289%2B3%29,

    The answer will be 288.

If you ask Google,

    The answer will be (48 / 2) * (9 + 3) = 288.

If you are Python programmer,

    >>> 48/2(9+3)
    TypeError: 'int 2' object is not callable
    >>> 48/2*(9+3)
    288
    >>> 48/(2*(9+3))
    2

If you are Java programmer,

    import static java.lang.System.out;
    int val = 48/2(9+3);
    out.println(val);
    1 error
    ';' expected right after 48/2
    int val = 48 / 2 ( 9 + 3 );
                          ^
If you use R program,

    > 48/2(9+3)
    Error: attempt to apply non-function of number 2.

If you love to spreadsheeting,

    =48/2(9+3)
    Microsoft Office Excel found an error in the formula you entered.
    Do you want to accept the correction proposed below?
    =48/2*(9+3)=288

If you use Matlab program,   

    >> 48/2(9+3)
    ??? 48/2(9+3)
                |
    Error: Unbalanced or unexpected parenthesis or bracket.

If you are C# certified,

    Console.WriteLine(48 / 2(9 + 3));
    // Method name expected instead of number 2
    Console.Write("\nPress any key to continue:");
    Console.Read();

If you think your answer is different, feel free to let me know about it.

No comments:

Newton-Raphson Method in C++

The Newton Raphson Method is an open method used to find the roots of a function. It employs the technique of linear approximation and invol...