Ryan S. answered • 03/17/20

Intern at Naval warfare center Software engineering, Undergrad student

1) If we follow the chain of commands in the functions we get:

int x = 5 * 2 //x=10

int y = (10+1)%3 // 11%3 = 2 hint: how many times does 3 go into 11? what is the remainder?

return (2-10) // returns -8

2) I don't know if we are missing something about the function g because I cannot decipher it. If I am missing something or if I can help in any other way send a message in this thread. I am following it.

Satyam P.

int g (int x, int y) { x = x + y; int z = 2 * x - y; return z; } What does g(-2, 5) evaluate to?03/18/20

Ryan S.

We follow the same strategy as we did before: x = -2+5 // x= 3 int z = 2 * x -y // Order of operations (z = 2*3-5) z = 1 return z // should be 1!03/18/20

Ryan S.

Sorry for the bad organization, the comment section is not great for answering questions.03/18/20

Ryan S.

If you need more help come check out my lessons! Best of luck with everything.03/18/20

Satyam P.

thanks and help me for Que(2)03/18/20