Computer Science, asked by imubasshira, 8 months ago

int f (int n) {
int ans = 0;
for (int i = 1; i < n; i++) {
if (i < n/2) {
ans -= i;
}
else {
ans += i;
}
}
return ans;
}
What does f(5) evaluate to?
What does f(7) evaluate to?
I need answer with explanation plz.

Answers

Answered by Imblank
1

Answer:

f(5) = 8

f(7) = 15

Ignore this

Similar questions