+ 1

For f(3,6) What is void doing here I thought the correct answer 31 but the answer is wrong

void f (int x, int y) { while (x < y) { printf("%d ", y - x); x = x + 1; y = y - 1; } }

3rd Apr 2020, 11:48 AM
Mohamad Alkaleeh
6 ответов
+ 1
Mohamad Alkaleeh Answer is 3 1 because there is space after %d
22nd Apr 2020, 12:05 PM
A͢J
A͢J - avatar
0
just need change this print("%d ", y-x); for this print("%d", y-x); xD the space lol
3rd Apr 2020, 11:57 AM
Marco
Marco - avatar
0
There is no problem with the code just what is the output?
3rd Apr 2020, 12:20 PM
Mohamad Alkaleeh
0
31 is the answer not?
3rd Apr 2020, 12:21 PM
Marco
Marco - avatar
0
I think so but Coursera System says wrong
3rd Apr 2020, 12:22 PM
Mohamad Alkaleeh
0
ok I understamd well, int Cursea System the answer is?
3rd Apr 2020, 12:23 PM
Marco
Marco - avatar