Find an Online Tutor Now

Satyam P.

asked • 03/17/20

What is this answer help me for this C FUNCTIONS answer?

Questions 1:- What does myFunction(5) evaluate to?


int myFunction(int n) {

 int x = n * 2;

 int y = (x + 1) % 3;

 return y - x;

}



Questions 2:- What does g(3,-10) evaluate to?


 int z = 2 * x - y;

 return z;



1 Expert Answer

By:

Ryan S. answered • 03/17/20

Tutor
5 (6)

Intern at Naval warfare center Software engineering, Undergrad student

Satyam P.

thanks and help me for Que(2)
Report

03/18/20

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?
Report

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!
Report

03/18/20

Ryan S.

Sorry for the bad organization, the comment section is not great for answering questions.
Report

03/18/20

Ryan S.

If you need more help come check out my lessons! Best of luck with everything.
Report

03/18/20

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.