Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

i need help with my programing homework.... please

0 votes
asked Apr 7, 2020 by Dragan Velinov (120 points)
The integer function g is defined with two integer arguments x and y.

int g(int x, int y)

{y = y % 5;

int r= 2 * x - y;

return r;}

What will be the value of the integer variable t after executing the next command?

t = g (g(12, 22),4);

1 Answer

0 votes
answered Apr 13, 2020 by Rishi Sharma (140 points)
Computing g(12, 22)

y = 22%5         ======> y = 2;

r = 2*x - y         ======>  2*12 - 2 = 24 - 2 = 22;

return 22;

g(g(12, 22), 4)  ======>  g(22, 4)

Computing g(22, 4)

y = 4%5 =====> y = 4;

r = 2*x - y =====> 2*22 - 4 = 44 - 4 = 40;

return 40;

Final Answer = 40
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...