Computer Science, asked by chetanac, 10 months ago

for the following code
int myfunction(int n){
int x=n*2;
int y=(x+1)%3;
return y-x;
}
what does myfunction (4) evaluate to?

Answers

Answered by bktbunu
4

Explanation:

myfunction (4) works as follows :

n = 4

x = n*2 = 4*2 = 8

y = (x+1)%3 = (8+1)%3 = 9%3 = 0

return y-x

that means it returns 0-8 = -8

Similar questions