Problem

Consider the following functions: int find(int num) { int first, second; first = num...

Consider the following functions:

int find(int num)

{

int first, second;

first = num * num;

second = first + num;

if (second > 100)

num = first / 10;

else

num = first / 20;

return num + 2;

}

int discover(int one, int two)

{

int secret = 0;

for (int i = one; i < two; i++)

secret = secret + i * i;

return secret;

}

What is the output of each of the following program segments?

a. cout << find(15) << endl;

b. cout << discover(3, 9) << endl;

c. cout << find(10) << " " << discover(10, find(10)) << endl;

d. x = 12; y = 8;

cout << discover(y, x) << endl;

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT