✏️ Explanatory Question

If int n[] = {1, 2, 3, 5, 7, 9, 13, 16}, what are the values of x and y?

x = Math.pow(n[4], n[2]);
y = Math.sqrt(n[5] + n[7]);

👁 81 Views
📘 Detailed Answer
🟡 Medium
💡

Answer with Explanation

    x = Math.pow(n[4], n[2]);
⇒ x = Math.pow(7, 3);
⇒ x = 343.0;

    y = Math.sqrt(n[5] + n[7]);
⇒ y = Math.sqrt(9 + 16);
⇒ y = Math.sqrt(25);
⇒ y = 5.0;