**call by value **

is 5

**Call by reference **

foo(5,5)

in foo( x=5 , y=5)

x=x+y // 5+5 = 10 therefore x store 10

y=y+x // y initially has value =5 , geting added to modified value of x which is now , 10 therefore y = 5 + 10 = 15

on exiting from this ffunction x and y are copied back to x finally 15 get stored in x .

answer i m getting as 5 and 15 .

What is wrong with my logic ??