214k views
0 votes
Assume you have an int variable x that has been declared and initialized. Assume the existence of a function named tripled . This function receives an integer and returns three times its value. So, pass tripled 12 and it will return 36. DO NOT DEFINE this function-- just assume it is available. What you must do here is write an expression whose value is twenty-seven times x. In this expression do NOT use any integer literals (like 27) or arithmetic operations (like *). Instead, just use x and function calls to tripled.

1 Answer

4 votes

Answer:

tripled(tripled(tripled (x)))

Step-by-step explanation:

  • tripled (x)

As a function is declared already which performs by giving 3 times of a input value say x.

  • (tripled(tripled (x))

Two times when the function tripled will be applied to x will give 9 times of x.

  • tripled(tripled(tripled (x)))

Similarly, when three time a function tripled is applied to x it will give 27 times of x as an output.

As an easy presentation:

Just represent the function tripled by 3 and replace it in the function.

It will give: (3(3(3 x)))= (3(9 x))= 27 x

User Steph
by
5.3k points