115k views
1 vote
What is the ending value of y? sqrt(u) returns the square root of u. pow(u, v) returns u raised to the power of v. x = 9.0; y = 4.0; y = pow(sqrt(x), sqrt(y));

User DaveV
by
6.9k points

1 Answer

7 votes

Answer:

The ending value of y is 9.0

Step-by-step explanation:

Given

x = 9.0;

y=4.0

y =pow(sqrt(x),sqrt(y));

Required

Determine the end value of y

Lines 1 and 2 initialize the values of x and y to be 9.0 and 4.0 respectively.

The instruction on line 3 can then be translated to:


y =pow(sqrt(9.0),sqrt(4.0));

From the hint in the question, we understand that:


sqrt(a) = \sqrt{a

Apply this hint on sqrt(9.0) and sqrt(4.0); this gives:


sqrt(9.0) = 3.0


sqrt(4.0) = 2.0

So, we have:


y =pow(3.0,2,0);

Also, from the hint; we understand that:


pow(a,b) = a^b

When this hint is applies,


y = pow(3.0,2,0) = 3.0^(2.0)

i.e.


y = 3.0^(2.0)


y = 9.0

Hence, the ending value of y is 9.0

User Kent Mewhort
by
7.1k points