Let us trace the functions step-by-step:
The function g(n) returns n+10.
The function f(n) calls g(2n), which evaluates to:
f(n)=2n+10 The expression $g(f(n))$ evaluates to:
g(f(n))=f(n)+10=(2n+10)+10=2n+20
Now, trace the for loop in main() with initial sum = 0:
Iteration 1 (n=1):
g(f(1))=2(1)+20=22 sum=0+22=22 Iteration 2 (n=2):
g(f(2))=2(2)+20=24 sum=22+24=46 Iteration 3 (n=3): The condition n<3 evaluates to false, and the loop terminates.
printf("%d", sum) prints 46.