 ``````int chi(int a) {
int b = foo(a);
if(b  < 5 ) {
return a - b;
}
else {
return a - b + 10;
}
}
``````
• 47
• 283
• 0
how to do this question?

Is this homework?

Can you post the entire task?

It is not understandable

its a question in class question thats the question

What is the value returned by each of the following functions if the value of the parameter passed is:

1. 47
2. 283
3. 0

println(chi(47)); in setup()

Chrisir

The returned value would depends on what the function `foo()` does I’d say. Are you certain this is everything?

Excellent

You need setup and my println() line above within setup

Then test all 3 values with all 3 functions

this is a practice for my final exam i am not going to be able to have processing program i need to do it on pen and paper

ah, ok.

You could make a table

``````                      2.1           |            2.2           |      2.3
47     |
283    |
0      |
``````

and fill this.

Start by looking at what `foo()` does, as @Tiemen suggested. It was defined previously: the code from question 2.3 calls the code from question 2.1…

I‘m not quite sure where you have a problem… if you have to do it on pen and paper, just replace the variable name a with the variable you are testing for.

So for 2.3 it would just look like this :

``````int chi (47) {
int b = foo(47) = 47%10 = 7
if (7 < 5) {
return 47 - 7 = 40;
} else {
return 47 - 7 + 10 = 50; // this one will be returned
}
}
``````

I have to say, this i very Basic Math (3rd elementary at most) and the most basic principle of programming (knowing that variables have values and that functions are evaluated right when they are called before going on to the next line and knowing how return works)…