
Patrick B. answered 06/25/20
Math and computer tutor/teacher
f(-1,4) --> x = -1 and y = 4
enters while loop as -1 < 4
OUTPUTS 5
x=0
y = 3
while loop: 0 < 3
outputs 3
x=1
y=2
while loop : 1<3
outputs 1
x=2
y = 1
while loop test condition fails
THe output is 5 3 1
------------------------------------------------
Here is the complete code:
#include <stdio.h>
void f (int x, int y)
{
while (x < y)
{
printf("%d ", y - x);
x = x + 1;
y = y - 1;
}
}
int main()
{
f(-1,4);
}